Skip to content Skip to sidebar Skip to footer

Python Machine Learning Algorithm To Recognize Known Events

I have two sets of data. These data are logged voltages of two points A and B in a circuit. Voltage A is the main component of the circuit, and B is a sub-circuit. Every positive v

Solution 1:

An idea:

from sklearn.ensemble import RandomForestClassifier

n = 5
X = [df.A.iloc[i:i+n] for i in df.index[:-n+1]] 
labels = (df.B > 0)[n-1:]

model = RandomForestClassifier()
model.fit(X, labels)
model.predict(X)

What this does is, it takes the previous n observations as predictors for the 'B' value. On this small data set it achieves 0.94 accuracy (could be overfitting).

EDIT: Corrected a small alignment error.

Post a Comment for "Python Machine Learning Algorithm To Recognize Known Events"