Пример #1
0
def deserialize_lasso_regressor(model_dict):
    model = Lasso(model_dict["params"])
    model.coef_ = np.array(model_dict["coef_"])
    if isinstance(model_dict["n_iter_"], list):
        model.n_iter_ = np.array(model_dict["n_iter_"])
    else:
        model.n_iter_ = int(model_dict["n_iter_"])
    if isinstance(model_dict["intercept_"], list):
        model.intercept_ = np.array(model_dict["intercept_"])
    else:
        model.intercept_ = float(model_dict["intercept_"])

    return model
Пример #2
0
def deserialize_lasso_regressor(model_dict):
    model = Lasso(model_dict['params'])

    model.coef_ = np.array(model_dict['coef_'])

    if isinstance(model_dict['n_iter_'], list):
        model.n_iter_ = np.array(model_dict['n_iter_'])
    else:
        model.n_iter_ = int(model_dict['n_iter_'])

    if isinstance(model_dict['intercept_'], list):
        model.intercept_ = np.array(model_dict['intercept_'])
    else:
        model.intercept_ = float(model_dict['intercept_'])

    return model