I am having troble searching for materials on this matter. Don't know exactly what search for.
I am trying to get the result of my Logistic Regression classfier (that outputs a timeseries binary class), and make a filter that takes a window of X answers and if the number of positives of that given window is greater than a given treshold, only then the sample gets a positive.
My input is a time series with many features of a company process, such as currents, pressures and so on. I am trying to make a fault detection algorithm. So because my output is so noisy I want to make it more time consistent.
Solved.
for train_index, test_index in logo.split(X, y, groups):
X_train, X_test = X.iloc[train_index], X.iloc[test_index]
y_train, y_test = y[train_index], y[test_index]
model.fit(X_train, y_train.ravel())
y_pred = model.predict(X_test)
y_pred_filtrado = pd.Series(y_pred).rolling(filtro,min_periods=1).sum() #getting a sum of the window
y_pred_filtrado = np.where(y_pred_filtrado>treshold, 1, 0) #if sum is greater than a treshhold output is positive