from mozinor.baboulinet import Baboulinet

"""
Explanation: Use mozinor for regression
Import the main module
End of explanation
"""


cls = Baboulinet(filepath="toto2.csv", y_col="predict", regression=True)

"""
Explanation: Prepare the pipeline
(str) filepath: Give the csv file
(str) y_col: The column to predict
(bool) regression: Regression or Classification ?
(bool) process: (WARNING) apply some preprocessing on your data (tune this preprocess with params below)
(char) sep: delimiter
(list) col_to_drop: which columns you don't want to use in your prediction
(bool) derivate: for all features combination apply, n1 * n2, n1 / n2 ...
(bool) transform: for all features apply, log(n), sqrt(n), square(n)
(bool) scaled: scale the data ?
(bool) infer_datetime: for all columns check the type and build new columns from them (day, month, year, time) if they are date type
(str) encoding: data encoding
(bool) dummify: apply dummies on your categoric variables

The data files have been generated by sklearn.dataset.make_regression
End of explanation
"""


res = cls.babouline()

"""
Explanation: Now run the pipeline
May take some times
End of explanation
"""


cls.bestModelScript()

"""
Explanation: The class instance, now contains 2 objects, the model for this data, and the best stacking for this data
To make auto generate the code of the model
Generate the code for the best model
End of explanation
"""


cls.bestStackModelScript()

"""
Explanation: Generate the code for the best stacking
End of explanation
"""


res.best_model

show = """
    Model: {},
    Score: {}
"""
print(show.format(res.best_model["Estimator"], res.best_model["Score"]))

"""
Explanation: To check which model is the best
Best model
End of explanation
"""


res.best_stack_models

show = """
    FirstModel: {},
    SecondModel: {},
    Score: {}
"""
print(show.format(res.best_stack_models["Fit1stLevelEstimator"], res.best_stack_models["Fit2ndLevelEstimator"], res.best_stack_models["Score"]))

"""
Explanation: Best stacking
End of explanation
"""


