在编写Java程序时,我们setSeed在Random课堂上使用.我们为什么要使用这种方法?
我们不能在不使用的Random情况下使用setSeed吗?使用的主要目的是setSeed什么?
我试图计算逻辑回归.我把数据作为csv文件.看起来像
node_id,second_major,gender,major_index,year,dorm,high_school,student_fac
0,0,2,257,2007,111,2849,1
1,0,2,271,2005,0,51195,2
2,0,2,269,2007,0,21462,1
3,269,1,245,2008,111,2597,1
..........................
Run Code Online (Sandbox Code Playgroud)
这是我的编码.
import pandas as pd
import statsmodels.api as sm
import pylab as pl
import numpy as np
df = pd.read_csv("Reed98.csv")
print df.describe()
dummy_ranks = pd.get_dummies(df['second_major'], prefix='second_major')
cols_to_keep = ['second_major', 'dorm', 'high_school']
data = df[cols_to_keep].join(dummy_ranks.ix[:, 'year':])
train_cols = data.columns[1:]
# Index([gre, gpa, prestige_2, prestige_3, prestige_4], dtype=object)
logit = sm.Logit(data['second_major'], data[train_cols])
result = logit.fit()
print result.summary()
Run Code Online (Sandbox Code Playgroud)
当我在python中运行编码时出现错误:
Traceback (most recent call last):
File "D:\project\logisticregression.py", line 24, in <module>
result = logit.fit()
File "c:\python26\lib\site-packages\statsmodels-0.5.0-py2.6- win32.egg\statsmodels\discrete\discrete_model.py", line …Run Code Online (Sandbox Code Playgroud) 我是Eclipse接口命令提供程序的新代码.我在网站上看到了一个例子
public void _say(CommandInterpreter ci) {
ci.print("You said:" + ci.nextArgument());
}
@Override
public String getHelp() {
return "\tsay - repeats what you say\n";
}
Run Code Online (Sandbox Code Playgroud)
它用于将命令作为String并再次打印.
现在这是执行命令的另一个
String command = intcp.nextArgument();
if (command != null) {
intcp.execute(command);
}
Run Code Online (Sandbox Code Playgroud)
为什么我们使用这种execute(command)方法?以及如何使用它?它有什么例子吗?
java ×2
eclipse ×1
networkx ×1
numpy ×1
osgi ×1
osgi-bundle ×1
pandas ×1
python ×1
random ×1
statsmodels ×1