<jupyter_start><jupyter_text>Saving models and encoders<jupyter_code>from sklearn.externals import joblib
def save_estimator(model , path):
    try:
        joblib.dump(model , path)
    except Exception as e:
        return e
        
        
    return "Saved sucessfully"
print(save_estimator(model_oh , 'estimators/model_oh.sav'))
print(save_estimator(model_hel , 'estimators/model_hel.sav'))

print(save_estimator(onehotencoder  , 'estimators/encoder_oh.sav'))
print(save_estimator(helmert_encoder, 'estimators/encoder_hel.sav'))

print(save_estimator(binarizer , 'estimators/encoder_label.sav'))<jupyter_output>Saved sucessfully
Saved sucessfully
Saved sucessfully
Saved sucessfully
Saved sucessfully
{'fraction_non_alphanumeric': 0.09335219236209336, 'fraction_numerical': 0.0, 'mean_word_length': 5.555555555555555, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '556127', 'license': 'MIT', 'n_tokens_mistral': 260, 'n_tokens_neox': 252, 'n_words': 41, 'path': 'notebooks/.ipynb_checkpoints/5(4)_Final-Model-checkpoint.ipynb', 'repo_name': 'sai-krishna-msk/KickAssist', 'size': '707'}