How can I perform scikit learn quantile transformation/ normalization on stream object #686
-
The following is some reproducible data and code to generate the error: from river.stream import iter_pandas students=pd.DataFrame() students['r_no']=[1,2,3,4,5] x_students=students.drop(['pass'],axis=1) c1 = ensemble.AdaptiveRandomForestClassifier(split_confidence=0.01,tie_threshold=0.07, seed=123) trans_st1 = QuantileTransformer(n_quantiles=3, random_state=123) strm_st1=iter_pandas(X=x_students,y=y_students) metric1 = metrics.Accuracy() y_preds_st1 = [] for ((xi1, yi1),(xi2, yi2)) in zip(strm_st1,strm_st2): new_xi1=trans_st1.fit_transform(xi1) new_xi2=trans_st2.fit_transform(xi2) y_pred1 = c1.predict_one(xi1) y_pred2 = c2.predict_one(xi2) c1.learn_one(xi1, yi1) c2.learn_one(xi2, yi2) metric1.update(y_pred=y_pred1, y_true=yi1) metric2.update(y_pred=y_pred2, y_true=yi2) y_preds_st1.append(y_pred1) y_preds_st2.append(y_pred2) print(f"Accuracy for c1: {metric1.get()}") print(f"Accuracy for c2: {metric2.get()}") How can Quantile transformation be performed on river stream object in an incremental fashion? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
You're using a scikit-learn transformer in a River context. Obviously that won't work. I assume you're asking if we could implement a Also, can you please add this code in plaintext instead of screenshots? We can't copy/paste the code as it is. Please use fences to highlight your code. |
Beta Was this translation helpful? Give feedback.
You're using a scikit-learn transformer in a River context. Obviously that won't work. I assume you're asking if we could implement a
QuantileTransformer
in River?Also, can you please add this code in plaintext instead of screenshots? We can't copy/paste the code as it is. Please use fences to highlight your code.