I've just started with machine learning. I managed to build logistic regression model with 10 features. All features are feature scaled and centered around 0. Train/test ratio is around
My code in Python:
# Training set imputer_train = Imputer(missing_values='NaN', strategy='mean', axis=0) imputer_train = imputer_train.fit(self.X_train) self.X_train = imputer_train.transform(self.X_train) # Test set imputer_test = Imputer(missing_values='NaN', strategy='mean', axis=0) imputer_test = imputer_test.fit(self.X_test) self.X_test = imputer_test.transform(self.X_test) # Feature scaling self.sc_X = StandardScaler() self.X_train = self.sc_X.fit_transform(self.X_train) self.X_test = self.sc_X.transform(self.X_test) # Fitting Logistic Regression to the Training set from sklearn.linear_model import LogisticRegression self.classifier = LogisticRegression() self.classifier.fit(self.X_train, self.y_train) self.y_pred = self.classifier.predict(self.X_test) self.y_pred_proba = self.classifier.predict_proba(self.X_test)[:, 1] logistic_loss = log_loss(y_true=self.y_test, y_pred=self.y_pred_proba) print "Logistic loss: %2.3f%%" % (logistic_loss * 100)
Model correctness: ~94% Logistic loss: ~14%
When I try to test my model with single test which consist of
X_test = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
I get my
If I calculate features for a single event like this:
X_test = [0.113591, 0.044682, 0.41523, -0.00565, 0.063624, 1.159652, 0, 0.090699, 0.184688, 0]
y_pred = 0.57806259.
And then I invert calculation of the same event I get features:
X_test_inverted = [-0.113591, -0.044682, -0.41523, 0.00565, -0.063624, -1.159652, 0, -0.090699, -0.184688, 0]
y_pred = 0.27111127.
Is this normal that probability of inverted events dont sum up to 1? Why is this so?
If not, where can I start to fix that problem?