accuracy: 0.8068054280175492
| target | precision | recall | f1-score | support |
|---|---|---|---|---|
| functional | 0.90 | 0.80 | 0.85 | 12051 |
| functional needs repair | 0.29 | 0.63 | 0.40 | 665 |
| non functional | 0.77 | 0.84 | 0.80 | 6886 |
| import numpy as np | |
| import tensorflow as tf | |
| from keras.callbacks import TensorBoard | |
| from keras.layers import Input, Dense | |
| from keras.models import Model | |
| def write_log(callback, names, logs, batch_no): | |
| for name, value in zip(names, logs): | |
| summary = tf.Summary() |
| params_rf = { | |
| 'clf__n_estimators':[ | |
| 100, | |
| 300, | |
| 500 | |
| ], | |
| 'clf__min_samples_leaf': [ | |
| 1, | |
| 2, | |
| 4 |
| @utils.timeit | |
| def evaluate_classifier(clf, X, y, scoring='accuracy'): | |
| scores = cross_val_score(clf, X, y, scoring='accuracy', cv=StratifiedKFold(3), verbose=0) | |
| name = type(clf).__name__ if (type(clf).__name__ != 'Pipeline') else type(clf.steps[-1][1]).__name__ | |
| print(f'{name} : {scores.mean()} +/- {scores.std()}') |
| def get_pipeline_model(clf): | |
| return Pipeline([ | |
| ('preprocess', preprocess_pipeline()), | |
| ('clf', clf) | |
| ]) |
| get_numeric_data = FunctionTransformer(lambda df: df[NUMERIC_COLUMNS]) | |
| get_text_data = FunctionTransformer(lambda df: df[TEXT_COLUMNS]) | |
| get_date_data = FunctionTransformer(lambda df: df[['date_recorded']]) | |
| transform_date_data = FunctionTransformer(lambda df: df.assign( | |
| date_recorded_day=df.date_recorded.dt.day, | |
| date_recorded_month=df.date_recorded.dt.month, | |
| date_recorded_year=df.date_recorded.dt.year | |
| ).drop('date_recorded', axis=1)) |
| def preprocess_pipeline(): | |
| return FeatureUnion( | |
| transformer_list = [ | |
| ('date_features', Pipeline([ | |
| ('selector', get_date_data), | |
| ('transform', transform_date_data) | |
| ])), | |
| ('numeric_features', Pipeline([ | |
| ('selector', get_numeric_data), | |
| ('imputer', SimpleImputer()), |
| { | |
| "name": "node-ts-barebones", | |
| "version": "0.0.1", | |
| "description": "Barebones NodeJS setup with TypeScript, Jest, TSLint and Prettier", | |
| "author": "Tiago Pina - <tiagoaspina@gmail.com>", | |
| "license": "MIT", | |
| "scripts": { | |
| "build": "tsc -p tsconfig.build.json", | |
| "format": "prettier --write \"src/**/*.ts\"", | |
| "start": "ts-node -r tsconfig-paths/register src/main.ts", |
While the following structure is not an absolute requirement or enforced by the tools, it is a recommendation based on what the JavaScript and in particular Node community at large have been following by convention.
Beyond a suggested structure, no tooling recommendations, or sub-module structure is outlined here.
lib/ is intended for code that can run as-issrc/ is intended for code that needs to be manipulated before it can be used