我无法在我的Windows机器上安装tsne软件包.我按照这里的说明安装了Python的tsne包.但无论是pip install tsne或pip install git+https://github.com/danielfrg/tsne.git工作.错误按摩是
tsne/bh_sne_src/quadtree.cpp(12) : fatal error C1083: Cannot open include file: 'cblas.h': No such file or directory
error: command 'C:\\Users\\hzoe\\AppData\\Local\\Programs\\Common\\Microsoft\\Visual C++ for Python\\9.0\\VC\\Bin\\amd64\\cl.exe' failed with exit status 2
----------------------------------------
Failed building wheel for tsne
Running setup.py clean for tsne
Failed to build tsne
Installing collected packages: tsne
Running setup.py install for tsne: started
Running setup.py install for tsne: finished with status 'error'
Complete output from command C:\Users\hzoe\AppData\Local\Continuum\Anaconda\python.exe -u -c "import setuptools, …Run Code Online (Sandbox Code Playgroud) 我正在使用sklearn Pipeline和FeatureUnion从文本文件创建功能,我想打印出功能名称.
首先,我将所有转换收集到一个列表中.
In [225]:components
Out[225]:
[TfidfVectorizer(analyzer=u'word', binary=False, decode_error=u'strict',
dtype=<type 'numpy.int64'>, encoding=u'utf-8', input=u'content',
lowercase=True, max_df=0.85, max_features=None, min_df=6,
ngram_range=(1, 1), norm='l1', preprocessor=None, smooth_idf=True,
stop_words='english', strip_accents=None, sublinear_tf=True,
token_pattern=u'(?u)[#a-zA-Z0-9/\\-]{2,}',
tokenizer=StemmingTokenizer(proc_type=stem, token_pattern=(?u)[a-zA-Z0-9/\-]{2,}),
use_idf=True, vocabulary=None),
TruncatedSVD(algorithm='randomized', n_components=150, n_iter=5,
random_state=None, tol=0.0),
TextStatsFeatures(),
DictVectorizer(dtype=<type 'numpy.float64'>, separator='=', sort=True,
sparse=True),
DictVectorizer(dtype=<type 'numpy.float64'>, separator='=', sort=True,
sparse=True),
TfidfVectorizer(analyzer=u'word', binary=False, decode_error=u'strict',
dtype=<type 'numpy.int64'>, encoding=u'utf-8', input=u'content',
lowercase=True, max_df=0.85, max_features=None, min_df=6,
ngram_range=(1, 2), norm='l1', preprocessor=None, smooth_idf=True,
stop_words='english', strip_accents=None, sublinear_tf=True,
token_pattern=u'(?u)[a-zA-Z0-9/\\-]{2,}',
tokenizer=StemmingTokenizer(proc_type=stem, token_pattern=(?u)[a-zA-Z0-9/\-]{2,}),
use_idf=True, vocabulary=None)]
Run Code Online (Sandbox Code Playgroud)
例如,第一个组件是TfidfVectorizer()对象.
components[0]
Out[226]:
TfidfVectorizer(analyzer=u'word', binary=False, decode_error=u'strict',
dtype=<type 'numpy.int64'>, encoding=u'utf-8', input=u'content', …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用 sklearn DecisionTreeClassifier 中的“tree_”方法提取最深节点的规则。我很难理解模型中 'children_left' 和 'children_right' 数组的含义。谁能帮忙解释一下?
estimator = DecisionTreeClassifier(max_depth=4, random_state=0)
estimator.fit(X_train, y_train)
estimator.tree_.children_left
[6] array([ 1, 2, 3, 4, 5, -1, -1, 8, -1, -1, 11, 12, -1, -1, 15, -1, -1,
18, 19, 20, -1, -1, 23, -1, -1, 26, 27, -1, -1, 30, -1, -1, 33, 34,
35, 36, -1, -1, 39, -1, -1, 42, 43, -1, -1, 46, -1, -1, 49, 50, 51,
-1, -1, 54, -1, -1, 57, 58, -1, -1, 61, -1, -1]) …Run Code Online (Sandbox Code Playgroud)