-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
27 changed files
with
6,038 additions
and
1,553 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# credentials.json |
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
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
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# from pycaret.classification import setup as classification_setup, compare_models as classification_compare_models, finalize_model | ||
# from pycaret.regression import setup as regression_setup, compare_models as regression_compare_models, finalize_model | ||
|
||
import pycaret.classification as pycaret_cl | ||
import pycaret.regression as pycaret_rg | ||
|
||
import pandas as pd | ||
import joblib | ||
|
||
def perform_classification(data, target_column): | ||
|
||
pycaret_cl.setup(data = data, target = target_column) | ||
best_model = pycaret_cl.compare_models() | ||
|
||
model_file_path = 'classification_model.pkl' | ||
joblib.dump(best_model, model_file_path) | ||
|
||
return best_model, model_file_path | ||
|
||
def perform_regression(data, target_column): | ||
|
||
pycaret_rg.setup(data = data, target = target_column) | ||
best_model = pycaret_rg.compare_models() | ||
|
||
model_file_path = 'regression_model.pkl' | ||
joblib.dump(best_model, model_file_path) | ||
|
||
return best_model, model_file_path | ||
|
||
def generate_model(data, target_column, task): | ||
|
||
df = pd.read_csv(data) # Supplied dataset | ||
task = task.upper() # Either R or C | ||
|
||
if task == 'C': | ||
perform_classification(df, target_column) # Call classification_setup() before classification_compare_models() | ||
final_model, model_file_path = perform_classification(df, target_column) | ||
elif task == 'R': | ||
perform_regression(df, target_column) # Call regression_setup() before regression_compare_models() | ||
final_model, model_file_path = perform_regression(df, target_column) | ||
|
||
return final_model, model_file_path | ||
|
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
Oops, something went wrong.