Python Forum
Feeding new data to a model
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Feeding new data to a model
#1
Good evening, kindof a beginner question here on how to properly feed new data (i.e. not seen during the model development) to a binary classification model. I have run my training and test data on several models and have chosen a particular model (Logistic Regression) to proceed with. I kindof took my new data set, divided it into two separate datasets (one dataset with 0s and the other with 1s) and fed each to the model - figuring this is dead wrong?

Any help on the matter would be greatly appreciate. Below is my code attempt:

# load new data
eval_file = 'StickyNickel_NewData.csv'
X_new, y_new = load_dataset(eval_file)
# separate the data between 0 and 1 classes
# first non-sticky nickel (class 0)
row_ix = where(y_new == 0)[0]
X_new_0 = X_new[row_ix]
# second sticky nickel (class 1)
row_ix = where(y_new == 1)[0]
X_new_1 = X_new[row_ix]

results = list()
# predict non-sticky cases
yhat = model.predict_proba(X_new_0)
mean_0 = yhat.mean(0)[0]
print(mean_0)
results.append(yhat[:, 0])

# predict stick_cases
yhat = model.predict_proba(X_new_1)
mean_1 = yhat.mean(0)[0]
print(mean_1)
results.append(yhat[:, 0])

pyplot.boxplot(results, labels=['0', '1'])
pyplot.show()
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Problems feeding live input from my microphone into a keras model (SegFault: 11) zeptozetta 1 981 Sep-14-2020, 03:08 AM
Last Post: zeptozetta

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020