我在我的centos6.5服务器上启动了一个Jupyter Notebook服务器.而jupyter正在运行
[I 17:40:59.649 NotebookApp] Serving notebooks from local directory: /root
[I 17:40:59.649 NotebookApp] 0 active kernels
[I 17:40:59.649 NotebookApp] The Jupyter Notebook is running at:https://[all ip addresses on your system]:8045/
[I 17:40:59.649 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
Run Code Online (Sandbox Code Playgroud)
当我想在同一局域网中远程访问Jupyter时,比如打开http://192.168.1.111:8045/,我根本无法打开Jupyter页面.顺便说一句,我可以成功访问远程centos服务器.
可能的原因是什么?
我正在为机器学习模型制作功能.我对虚拟变量和单热编码感到困惑.例如,一个类别变量'week'范围1-7.当使用单热编码时,编码week = 1为1,000,000,week = 2是0,100,000 ......但我也可以创建一个虚拟变量'week_v',以这种方式,我必须设置一个
hidden variable意味着基本变量,功能week_v = 1是100,000,week_v = 2是010,000 ......并且不会出现week_v = 7.那么它们之间的区别是什么?我正在使用逻辑模型然后我会尝试gbdt.
我想用 XGBoost 解决回归问题。我对学习任务参数目标 [ default=reg:linear ]( XGboost )感到困惑,**似乎“目标”用于设置损失函数。**但我无法理解“reg:linear”如何影响损失函数。在逻辑回归演示(XGBoost逻辑回归演示)中,objective = binary:logistic表示损失函数是逻辑损失函数。那么'objective=reg:linear'对应哪个损失函数?
有 2 个类:class A和class B. 在class A,我想调用一个方法class B。同时,在class B,我想调用一个方法class A。喜欢:
class A(object):
"""docstring for A"""
def __init__(self):
self.str_A = 'this is class A'
def printA(self):
print self.str_A
def callB(self):
B.printB()
class B(object):
"""docstring for B"""
def __init__(self):
self.str_B = 'This is class B'
def printB(self):
print self.str_B
def callA(self):
A.printA()
Run Code Online (Sandbox Code Playgroud)
嗯,我修改一下我的表达方式。
class A(object):
"""docstring for A"""
def __init__(self):
self.str_A = 'this is class A'
def printA(self):
print …Run Code Online (Sandbox Code Playgroud) 我创建了一个数据帧?
import pandas as pd
data = pd.DataFrame({'a':range(1,11),'b':['m','f','m','m','m','f','m','f','f','f'],'c':np.random.randn(10)})
Run Code Online (Sandbox Code Playgroud)
哪个看起来像?
a b c
0 1 m 0.495439
1 2 f 1.444694
2 3 m 0.150637
3 4 m -1.078252
4 5 m 0.618045
5 6 f -0.525368
6 7 m 0.188912
7 8 f 0.159014
8 9 f 0.536495
9 10 f 0.874598
Run Code Online (Sandbox Code Playgroud)
当我想选择一些行时,我运行
data[:2] or data.ix[2]
Run Code Online (Sandbox Code Playgroud)
但是当我尝试:
se = range(2)
data[se]
Run Code Online (Sandbox Code Playgroud)
有一个错误:
KeyError: 'No column(s) named: [0 1]'
Run Code Online (Sandbox Code Playgroud)
我知道 DataFrame 选择一个 col 作为默认值。运行时发生了什么data[se]?冒号(:) 在python 中是如何工作的?
在我的数据框中,某些行中有NaN值.我想删除这些行.我用dataframe.dropna(how ='any')解决了这个问题.结果如下:
date time open hign low close volume turnover
2 2015-09-01 931 48.60 48.60 48.00 48.00 449700 21741726
3 2015-09-01 932 47.91 48.33 47.91 48.25 158500 7614508
Run Code Online (Sandbox Code Playgroud)
我想重新索引我的数据帧的行,所以我运行:
length = dataframe.dropna(how='any').shape[0]
dataframe1 = dataframe.index(range(length))
Run Code Online (Sandbox Code Playgroud)
但是dataframe1仍然保留旧的索引值,例如:
date time open hign low close volume turnover
0 NaN NaN NaN NaN NaN NaN NaN NaN
1 NaN NaN NaN NaN NaN NaN NaN NaN
2 2015-09-01 931 48.60 48.60 48.00 48.00 449700 21741726
3 2015-09-01 932 47.91 48.33 47.91 48.25 158500 7614508 …Run Code Online (Sandbox Code Playgroud) 我已经安装了zmq和pyzmq.But我无法导入pyzmq.
>>> Successfully installed pyzmq
Cleaning up...
hepeng@hp:~$ python
enter code here
Python 2.7.6 (default, Jun 22 2015, 17:58:13)
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import pyzmq
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named pyzmq
Run Code Online (Sandbox Code Playgroud)
但我可以导入zmq.
>>> import zmq
>>>
Run Code Online (Sandbox Code Playgroud)
那么为什么呢?谢谢.