Logistic regression binary classification problem, there are 5 dependent variables

cqwrmjld 注册会员
2023-02-27 23:25

the reference answer GPT ᴼ ᴾ ᴱ ᴺ ᴬ ᴵ < br / > according to the code, you provide train has been reshape correctly into the shape of a(num_examples, 5), Each row represents a training sample and each column represents the value of a feature(factor). Therefore, if you want to train for this logistic regression dichotomy problem, you only need to use the dependent variable as the target variable and x_train as the independent variable. For example:

from sklearn.linear_model import LogisticRegression

# 假设y_train是长度为num_examples的目标变量
clf = LogisticRegression().fit(x_train, y_train)

After training, you can use clf.predict to predict new samples. For example:

y_pred = clf.predict(x_new)

Where x_new is an array of the shape(num_new_examples, 5) representing the eigenvalues of the new sample. y_pred is a one-dimensional array of length num_new_examples that represents the logistic regression classification of these new samples.

dongming1128 注册会员
2023-02-27 23:25

What is the error?

About the Author

Question Info

Publish Time
2023-02-27 23:25
Update Time
2023-02-27 23:25