小编Fra*_*urt的帖子

使用Oracle SQL Developer将CLOB导出到文本文件

我正在使用Oracle SQL Developer并尝试将表导出为CSV文件.某些字段是CLOB字段,在许多情况下,导出发生时会截断条目.我正在寻找一种方法来解决所有问题,因为我的最终目标是不在这里使用Oracle(我收到了一个Oracle转储 - 它被加载到一个oracle数据库中,但我正在使用其他格式的数据,所以通过CSV作为中间人).

如果对此有多种解决方案,鉴于对我来说这是一次性程序,我不介意更多涉及"做正确"解决方案的黑客类型解决方案.

sql oracle clob oracle-sqldeveloper

13
推荐指数
1
解决办法
6万
查看次数

13
推荐指数
2
解决办法
2万
查看次数

导入theano:AttributeError:'module'对象没有属性'find_graphviz'

当我import theano在Python中运行时,我收到以下错误消息:

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 theano
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.7/dist-packages/theano/__init__.py", line 74, in <module>
    from theano.printing import pprint, pp
  File "/usr/local/lib/python2.7/dist-packages/theano/printing.py", line 35, in <module>
    if pd.find_graphviz():
AttributeError: 'module' object has no attribute 'find_graphviz'
Run Code Online (Sandbox Code Playgroud)

可能是什么问题,以及如何解决它?

我在Ubuntu 14.04.4 LTS x64和Python 2.7.6 x64上使用Theano 0.8.2.


我没试成功:

  • sudo apt-get install -y graphviz libgraphviz-dev

python theano

13
推荐指数
2
解决办法
2万
查看次数

如何列出节点所依赖的所有Tensorflow变量?

如何列出节点所依赖的所有Tensorflow变量/常量/占位符?

示例1(添加常量):

import tensorflow as tf

a = tf.constant(1, name = 'a')
b = tf.constant(3, name = 'b')
c = tf.constant(9, name = 'c')
d = tf.add(a, b, name='d')
e = tf.add(d, c, name='e')

sess = tf.Session()
print(sess.run([d, e]))
Run Code Online (Sandbox Code Playgroud)

我想有一个功能list_dependencies(),如:

  • list_dependencies(d) 回报 ['a', 'b']
  • list_dependencies(e) 回报 ['a', 'b', 'c']

示例2(占位符和权重矩阵之间的矩阵乘法,然后添加偏差向量):

tf.set_random_seed(1)
input_size  = 5
output_size = 3
input       = tf.placeholder(tf.float32, shape=[1, input_size], name='input')
W           = tf.get_variable(
                "W",
                shape=[input_size, output_size],
                initializer=tf.contrib.layers.xavier_initializer())
b           = tf.get_variable(
                "b",
                shape=[output_size],
                initializer=tf.constant_initializer(2))
output      = …
Run Code Online (Sandbox Code Playgroud)

python tensorflow

13
推荐指数
1
解决办法
3899
查看次数

如何使用Caffe启用多线程?

我想编译/配置Caffe,以便当我用它训练人工神经网络时,训练是多线程的(仅CPU,没有GPU).如何使用Caffe启用多线程?我在Ubuntu 14.04 LTS x64上使用Caffe.

ubuntu multithreading neural-network deep-learning caffe

12
推荐指数
1
解决办法
1万
查看次数

CountVectorizer:没有安装词汇表

sklearn.feature_extraction.text.CountVectorizer通过在vocabulary参数中传递词汇表来实例化一个对象,但是我收到一条sklearn.utils.validation.NotFittedError: CountVectorizer - Vocabulary wasn't fitted.错误消息.为什么?

例:

import sklearn.feature_extraction
import numpy as np
import pickle

# Save the vocabulary
ngram_size = 1
dictionary_filepath = 'my_unigram_dictionary'
vectorizer = sklearn.feature_extraction.text.CountVectorizer(ngram_range=(ngram_size,ngram_size), min_df=1)

corpus = ['This is the first document.',
        'This is the second second document.',
        'And the third one.',
        'Is this the first document? This is right.',]

vect = vectorizer.fit(corpus)
print('vect.get_feature_names(): {0}'.format(vect.get_feature_names()))
pickle.dump(vect.vocabulary_, open(dictionary_filepath, 'w'))

# Load the vocabulary
vocabulary_to_load = pickle.load(open(dictionary_filepath, 'r'))
loaded_vectorizer = sklearn.feature_extraction.text.CountVectorizer(ngram_range=(ngram_size,ngram_size), min_df=1, …
Run Code Online (Sandbox Code Playgroud)

python nlp scikit-learn

12
推荐指数
1
解决办法
2万
查看次数

Python - 使用Pointwise互信息的情感分析

from __future__ import division
import urllib
import json
from math import log


def hits(word1,word2=""):
    query = "http://ajax.googleapis.com/ajax/services/search/web?v=1.0&q=%s"
    if word2 == "":
        results = urllib.urlopen(query % word1)
    else:
        results = urllib.urlopen(query % word1+" "+"AROUND(10)"+" "+word2)
    json_res = json.loads(results.read())
    google_hits=int(json_res['responseData']['cursor']['estimatedResultCount'])
    return google_hits


def so(phrase):
    num = hits(phrase,"excellent")
    #print num
    den = hits(phrase,"poor")
    #print den
    ratio = num / den
    #print ratio
    sop = log(ratio)
    return sop

print so("ugly product")
Run Code Online (Sandbox Code Playgroud)

我需要此代码来计算Point wise Mutual Information,它可用于将评论分类为正面或负面.基本上我使用Turney(2002)指定的技术:http://acl.ldc.upenn.edu/P/P02/P02-1053.pdf作为用于情感分析的无监督分类方法的示例.

正如文中所解释的,如果短语与"差"这个词更强烈地联系在一起,则短语的语义方向是否定的,如果与"优秀"这个词更强烈地联系在一起则是肯定的.

上面的代码计算短语的SO.我使用谷歌计算命中数并计算SO.(因为AltaVista现在不存在)

计算出的值非常不稳定.他们没有坚持特定的模式.例如,SO("丑陋产品")为2.85462098541,而SO("美丽产品")为1.71395061117.虽然前者预计是负面而另一个是积极的.

代码有问题吗?是否有更简单的方法来计算任何Python库(如NLTK)的短语(使用PMI)的SO?我试过NLTK但是却找不到任何计算PMI的显式方法.

python nlp nltk sentiment-analysis

11
推荐指数
2
解决办法
1万
查看次数

获得scikit-learn中多标签预测的准确性

标签分类设置中,sklearn.metrics.accuracy_score仅计算子集精度(3):即,为样本预测的标签集必须与y_true中的相应标签集完全匹配.

这种计算精度的方法有时被命名,可能不那么模糊,精确匹配率(1):

在此输入图像描述

有没有办法让其他典型的方法来计算scikit-learn的准确性,即

在此输入图像描述

(如(1)和(2)中所定义的,并且不那么模糊地称为汉明分数(4)(因为它与汉明损失密切相关),或基于标签的准确性)?


(1)Sorower,Mohammad S." 关于多标签学习算法的文献调查. "俄勒冈州立大学,Corvallis(2010年).

(2)Tsoumakas,Grigorios和Ioannis Katakis." 多标签分类:概述. "信息学系,希腊塞萨洛尼基亚里士多德大学(2006年).

(3)Ghamrawi,Nadia和Andrew McCallum." 集体多标签分类. "第14届ACM国际信息与知识管理会议论文集.ACM,2005.

(4)Godbole,Shantanu和Sunita Sarawagi." 用于多标记分类的判别方法. "知识发现和数据挖掘的进展.Springer Berlin Heidelberg,2004.22-30.

python classification scikit-learn

11
推荐指数
1
解决办法
6346
查看次数

查找Array中的所有NaN元素

在MATLAB中是否有一个命令允许我在数组中找到所有NaN(非数字)元素?

matlab nan

10
推荐指数
3
解决办法
6万
查看次数

在MySQL Workbench的数据建模工具中移动EER图中的关系箭头?

有没有办法在MySQL Workbench的数据建模工具中移动EER图中的关系箭头?(无需移动或调整任何表格)

例如之前:

在此输入图像描述

后:

在此输入图像描述

mysql-workbench

10
推荐指数
1
解决办法
4814
查看次数