-2

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.

Classfier Pattern

  • Not machine-learning related, what you want is a window function on a binary series, the source of this series doesn't matter. Implementing such a window function is pretty simple, however, your question mentions nothing on how this series is provided technology-wise and therefore can't be answered. – Danny Varod Dec 22 '20 at 13:16
  • Hi @DannyVarod I added some information. Would you be able to point me in the right direction?That is all I need. I have no idea on how to search material on this area, all my google searchs give me image processing filters, I have found nothing on binary class time consistency filters. – Higor Nunes Dec 22 '20 at 13:28
  • Higor, try and replace the tags with relevant ones i.e. remove all existing tags, add relevant tags e.g. 'python`, 'kafka`. Add code to question (as code, not images). Do not add links if they are required reading as a. they don't last, b. no one should have to visit them to understand. – Danny Varod Dec 22 '20 at 14:03

1 Answers1

0

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