Saving Model Results from Python Recipe

nsrishan
Level 2
Saving Model Results from Python Recipe

Hello,

First time working on a dataiku project. I've created a Python recipe after importing my data that does data cleaning, train/test split and has a model function that returns model results. I am trying to write it all through python and not utilize other recipes. Would there be a way from this to document the results of the model for model comparisons through Python?

def model(X_train, y_train, X_test, y_test, model):

model = model

model.fit(X_res, y_res)
y_pred = model.predict(X_test)

f1 = f1_score(y_test, y_pred, average="macro")
acc = accuracy_score(y_test, y_pred)
prec = precision_score(y_test, y_pred, average=None)
recall = recall_score(y_test, y_pred, average=None)

print(f1_score,acc,prec,recall)

tracker.stop()

return f1, acc, prec, recall

 

 

 

0 Kudos
1 Reply
CatalinaS
Dataiker

Hi @nsrishan

The results of your model can be stored in an output dataset. Then you can use this dataset as an input in another Python recipe to compare the results of the model.

Examples of how to write the data in a dataset are here:  
 
What type of data does your model return?