- Yellowbrick: for visualisations
- ELI5:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import matplotlib.pyplot as plt | |
import numpy as np | |
from numpy import genfromtxt | |
#genfromtxt('my_file.csv', delimiter=',') | |
# Set the random seed for data generation |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
with open('indlib8.csv') as f: | |
...: reader = csv.reader(f) | |
...: for row in reader: | |
...: p = Indicator() | |
...: arr.append(p) | |
...: p.save() | |
p = Indicator(level = row[0], sector =row[5], subsector=row[6], number = row[1], definition = row[7],justification = row[8], unit_of_measure = row[9], disaggregation = row[11], direction_of_change = row[12], baseline = row[13], rationale_for_target = row[15], means_of_verification = row[16], question_format = row[17], data_collection_method = row[18], denominator = row[20], numnerator = row[21], responsible_person = row[22], methods_of_analysis = row[23], information_use = row[24], quality_assurance = row[26], data_issues = row[27],indicator_changes = row[28], comments = row[29]) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from dash.dependencies import Input, Output | |
import dash_html_components as html | |
import dash_core_components as dcc | |
import pandas as pd | |
app = dash.Dash() | |
app.layout = html.Div([ | |
html.H1('Please enter the input'), | |
dcc.Input(id='my-id', value='initial value', type='text'), | |
html.Div(id='my-div') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
app.layout = html.Div([ | |
html.H2('Tolareports'), | |
dcc.Dropdown( | |
value='2017', | |
options=[{'label': i, 'value': i} for i in ['2017', '2018']], | |
multi=False, | |
id='dropdown-year', | |
placeholder="Select Year",), | |
dcc.Graph(id = 'table-1-1'), | |
dcc.Graph(id = 'table-1-2'), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--------------------------------------------------------------------------- | |
OpenMLServerException Traceback (most recent call last) | |
<ipython-input-8-b6154457ed10> in <module>() | |
6 run = openml.runs.run_model_on_task(model, task, avoid_duplicate_runs=False) | |
7 # Publish the experiment on OpenML (optional, requires an API key). | |
----> 8 run.publish() | |
9 | |
10 print('URL for run: %s/run/%d' % (openml.config.server, run.run_id)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Code for entire dataset to pyarrow table | |
import pyarrow as pa | |
import pyarrow.parquet as pq | |
# getting the dataset | |
did=39947 | |
d = openml.datasets.get_dataset(did, download_qualities=False) | |
df , *_ = d.get_data(dataset_format="dataframe", include_row_id=True, include_ignore_attribute=True) | |
df = df[[f.name for f in d.features.values()]] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
p = Pipeline(steps=[('imputation', SimpleImputer(strategy='median')),('1', SMOTE(k_neighbors=21)),('0', EasyEnsembleClassifier(n_estimators=100))]) | |
try: | |
if p['imputation']: | |
p = p[1:] | |
except: | |
pass | |
print(p) | |
l = [] | |
for i in range(len(p)): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import openml | |
t = openml.runs.get_run_trace(10437679) | |
l = list() | |
for ts in t.trace_iterations.keys(): | |
d1 = t.trace_iterations[ts].__dict__ | |
d2 = t.trace_iterations[ts].get_parameters() | |
d1.pop('setup_string') | |
d3 = {**d1, **d2} |