LogisticRegression中的语法错误

时间:2017-03-14 08:02:32

标签: logistic-regression

我在LogisticRegression的以下命令中遇到语法错误。有人可以告诉我这里可能出错的地方吗?

from sklearn import linear_model
lm =  linear_model.LogisticRegression (C = 1e3)
lm.fit (m[:lags].T, np.sign(m[lags])
LogisticRegression (penalty ='l2', tol = .0001, C = 1000000.0, class_weight = None, dual = False, fit_intercept = True, 
intercept_scaling = 1, random_state = None, solver ='liblinear', max_iter = 100, multi_class ='ovr',verbose = 0, 
warm_start = False, n_jobs = 1)

错误:

File "<ipython-input-33-529ff9190586>", line 4
    LogisticRegression (penalty ='l2', tol = .0001, C = 1000000.0, class_weight = None, dual = False, fit_intercept = True,
                     ^
SyntaxError: invalid syntax

1 个答案:

答案 0 :(得分:1)

你在这里缺少右括号:

lm.fit (m[:lags].T, np.sign(m[lags]) <--

更改为

lm.fit (m[:lags].T, np.sign(m[lags]))