From 69cef0703967e2ffd8ee1a0db721de66332cb17a Mon Sep 17 00:00:00 2001 From: nidhal baccouri Date: Fri, 19 Nov 2021 17:42:31 +0100 Subject: [PATCH] fixed pre commit hooks --- .../neural-network.yaml | 8 +-- .../random-forest.yaml | 29 ++++---- igel/__init__.py | 2 +- igel/__main__.py | 69 ------------------- setup.cfg | 2 +- 5 files changed, 21 insertions(+), 89 deletions(-) diff --git a/examples/indian-diabetes-example/neural-network.yaml b/examples/indian-diabetes-example/neural-network.yaml index d2a4ea2..5946c83 100644 --- a/examples/indian-diabetes-example/neural-network.yaml +++ b/examples/indian-diabetes-example/neural-network.yaml @@ -1,13 +1,13 @@ + + dataset: type: csv - random_numbers: - generate_reproducible: true - seed: 101 + # model definition model: type: classification algorithm: NeuralNetwork -# target you want to predict +# target(s) you want to predict target: - sick diff --git a/examples/indian-diabetes-example/random-forest.yaml b/examples/indian-diabetes-example/random-forest.yaml index c683632..2cb54ef 100644 --- a/examples/indian-diabetes-example/random-forest.yaml +++ b/examples/indian-diabetes-example/random-forest.yaml @@ -1,33 +1,34 @@ -# dataset operations dataset: type: csv random_numbers: generate_reproducible: true seed: 42 - split: # split options - test_size: 0.2 # 0.2 means 20% for the test data, so 80% are automatically for training - shuffle: True # whether to shuffle the data before/while splitting + split: + test_size: 0.2 + shuffle: True - preprocess: # preprocessing options - missing_values: mean # other possible values: [drop, median, most_frequent, constant] check the docs for more + preprocess: + missing_values: mean encoding: - type: oneHotEncoding # other possible values: [labelEncoding] - scale: # scaling options - method: standard # standardization will scale values to have a 0 mean and 1 standard deviation | you can also try minmax - target: inputs # scale inputs. | other possible values: [outputs, all] # if you choose all then all values in the dataset will be scaled + type: oneHotEncoding + scale: + method: standard + target: inputs - -# model definition model: type: classification algorithm: RandomForest arguments: n_estimators: 100 max_depth: 30 + hyperparameter_search: + method: random_search + parameter_grid: + max_depth: [6, 10] + n_estimators: [100, 300] + max_features: [auto, sqrt] - -# target you want to predict target: - sick diff --git a/igel/__init__.py b/igel/__init__.py index 5524d64..6f463a1 100644 --- a/igel/__init__.py +++ b/igel/__init__.py @@ -10,7 +10,7 @@ try: __version__ = version(__name__) except PackageNotFoundError: - __version__ = "0.5.0" + __version__ = "0.7.0" __author__ = "Nidhal Baccouri" diff --git a/igel/__main__.py b/igel/__main__.py index 9a9d403..b6cbbc1 100644 --- a/igel/__main__.py +++ b/igel/__main__.py @@ -8,7 +8,6 @@ import igel import pandas as pd from igel import Igel, metrics_dict -from igel.auto import IgelCNN from igel.constants import Constants from igel.servers import fastapi_server from igel.utils import print_models_overview, show_model_info, tableize @@ -73,29 +72,6 @@ def fit(data_path: str, yaml_path: str) -> None: Igel(cmd="fit", data_path=data_path, yaml_path=yaml_path) -@cli.command(context_settings=CONTEXT_SETTINGS) -@click.option( - "--data_path", "-dp", required=True, help="Path to your training dataset" -) -@click.option( - "--task", - "-t", - required=False, - help="task you want to run. This refers to the goal you want to achieve (e.g ImageClassification)", -) -@click.option( - "--yaml_path", - "-yml", - required=False, - help="Path to your igel configuration file (yaml or json file)", -) -def auto_train(data_path: str, task: str, yaml_path: str) -> None: - """ - Automatically search for and train a suitable deep neural network for a task - """ - IgelCNN(cmd="train", data_path=data_path, task=task, yaml_path=yaml_path) - - @cli.command(context_settings=CONTEXT_SETTINGS) @click.option( "--data_path", "-dp", required=True, help="Path to your evaluation dataset" @@ -107,17 +83,6 @@ def evaluate(data_path: str) -> None: Igel(cmd="evaluate", data_path=data_path) -@cli.command(context_settings=CONTEXT_SETTINGS) -@click.option( - "--data_path", "-dp", required=True, help="Path to your evaluation dataset" -) -def auto_evaluate(data_path: str) -> None: - """ - Evaluate the performance of an existing machine learning model - """ - IgelCNN(cmd="evaluate", data_path=data_path) - - @cli.command(context_settings=CONTEXT_SETTINGS) @click.option("--data_path", "-dp", required=True, help="Path to your dataset") def predict(data_path: str) -> None: @@ -127,15 +92,6 @@ def predict(data_path: str) -> None: Igel(cmd="predict", data_path=data_path) -@cli.command(context_settings=CONTEXT_SETTINGS) -@click.option("--data_path", "-dp", required=True, help="Path to your dataset") -def auto_predict(data_path: str) -> None: - """ - Use an existing machine learning model to generate predictions - """ - IgelCNN(cmd="predict", data_path=data_path) - - @cli.command(context_settings=CONTEXT_SETTINGS) @click.option( "--data_paths", @@ -161,31 +117,6 @@ def experiment(data_paths: str, yaml_path: str) -> None: Igel(cmd="predict", data_path=pred_data_path) -@cli.command(context_settings=CONTEXT_SETTINGS) -@click.option( - "--data_paths", - "-DP", - required=True, - help="Path to your datasets as string separated by space", -) -@click.option( - "--yaml_path", - "-yml", - required=True, - help="Path to your igel configuration file (yaml or json file)", -) -def auto_experiment(data_paths: str, yaml_path: str) -> None: - """ - train, evaluate and use pre-trained model for predictions in one command - """ - train_data_path, eval_data_path, pred_data_path = data_paths.strip().split( - " " - ) - IgelCNN(cmd="train", data_path=train_data_path, yaml_path=yaml_path) - IgelCNN(cmd="evaluate", data_path=eval_data_path) - IgelCNN(cmd="predict", data_path=pred_data_path) - - @cli.command(context_settings=CONTEXT_SETTINGS) @click.option( "--model_results_dir", diff --git a/setup.cfg b/setup.cfg index ec61380..b09b038 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 0.1.1 +current_version = 0.7.0 [darglint] strictness = long