wepe / machinelearning Goto Github PK
View Code? Open in Web Editor NEWBasic Machine Learning and Deep Learning
Basic Machine Learning and Deep Learning
Sssss
.github/workflows/ci.yml
Ok
File "/home/shaoym/anaconda2/lib/python2.7/copy_reg.py", line 70, in _reduce_ex
raise TypeError, "can't pickle %s objects" % base.name
TypeError: can't pickle module objects
楼主,我在执行您的cnn.py代码时,这个pickle module报上面的错误,不知是什么原因?
不胜感激!
Traceback (most recent call last):
File "C:\Users\liangxin\keras_usage\c
data, label = load_data()
File "C:\Users\liangxin\keras_usage\d
imgs = os.listdir("./mnist")
WindowsError: [Error 3] : './mnist/.'
刚刚学python没多久,想请问一下,python不是有很多现成的聚类了吗,有必要自己写吗?新人,盼解答
Traceback (most recent call last):
File "D:/cliff/Programmer-related/GPU_related/kerasѧϰ/dive_into_keras/cnn.py", line 62, in
model = create_model()
File "D:/cliff/Programmer-related/GPU_related/kerasѧϰ/dive_into_keras/cnn.py", line 38, in create_model
model.add(Convolution2D(4, 1, 5, 5, border_mode='valid')) # cliff, add "input_shape"
File "C:\Anaconda2\lib\site-packages\keras\models.py", line 106, in add
raise Exception('The first layer in a Sequential model must '
Exception: The first layer in a Sequential model must get an input_shape
or batch_input_shape
argument.
我运行的时候弹出这个错误信息,是怎么回事
Traceback (most recent call last):
File "G:/MyCode/mmnist/keras_usage/cnn.py", line 85, in
sgd = SGD(l2=0.1,lr=0.05, decay=1e-6, momentum=0.9, nesterov=True)
File "D:\Anaconda2\lib\site-packages\keras-1.0.3-py2.7.egg\keras\optimizers.py", line 117, in init
super(SGD, self).init(**kwargs)
File "D:\Anaconda2\lib\site-packages\keras-1.0.3-py2.7.egg\keras\optimizers.py", line 36, in init
'passed to optimizer: ' + str(k))
Exception: Unexpected keyword argument passed to optimizer: l2
您好,看到您博文上利用keras训练CNN并保存训练好的CNN模型,并未找到保存的model.pkl,cnn.py文件中没有用于保存的代码啊?
还有,我用cnn做文本分类的,如果想要把每层的输出写到文件里面,留作他用,该怎么操作?
其实,跟您写的cnn_svm**是一致的,提取特征之后再用其他的方法分类,但是不知道文本和图像得到输出的方法是不是一样
麻烦大神了!
D ddjh
position:
def save_params(param1, param2, param3, param4):
import cPickle # <-----
write_file = open('params.pkl', 'wb')
cPickle.dump(param1, write_file, -1)
cPickle.dump(param2, write_file, -1)
cPickle.dump(param3, write_file, -1)
cPickle.dump(param4, write_file, -1)
write_file.close()
When I ran 'MachineLearning-master/DeepLearning Tutorials/keras_usage/cnn.py', it occur these following problems. can you give me some advice?
`C:\Users\Edward\Anaconda2\python.exe "D:/project/Github/MachineLearning-master/DeepLearning Tutorials/keras_usage/cnn.py"
Using Theano backend.
42000 samples
Traceback (most recent call last):
File "D:/project/Github/MachineLearning-master/DeepLearning Tutorials/keras_usage/cnn.py", line 79, in
model.add(Dense(128, init='normal', input_dim=16_4_4))
File "C:\Users\Edward\Anaconda2\lib\site-packages\keras\models.py", line 308, in add
output_tensor = layer(self.outputs[0])
File "C:\Users\Edward\Anaconda2\lib\site-packages\keras\engine\topology.py", line 487, in call
self.build(input_shapes[0])
File "C:\Users\Edward\Anaconda2\lib\site-packages\keras\layers\core.py", line 695, in build
name='{}_W'.format(self.name))
File "C:\Users\Edward\Anaconda2\lib\site-packages\keras\initializations.py", line 36, in normal
return K.random_normal_variable(shape, 0.0, scale, name=name)
File "C:\Users\Edward\Anaconda2\lib\site-packages\keras\backend\theano_backend.py", line 145, in random_normal_variable
return variable(np.random.normal(loc=0.0, scale=scale, size=shape),
File "mtrand.pyx", line 1903, in mtrand.RandomState.normal (numpy\random\mtrand\mtrand.c:18479)
File "mtrand.pyx", line 234, in mtrand.cont2_array_sc (numpy\random\mtrand\mtrand.c:3092)
ValueError: negative dimensions are not allowed
Process finished with exit code 1
`
Traceback (most recent call last):
File "cnn.py", line 57, in
model.add(Convolution2D(4, 5, 5, border_mode='valid',input_shape=(1,28,28)))
File "/home/leo/anaconda2/lib/python2.7/site-packages/keras/models.py", line 276, in add
layer.create_input_layer(batch_input_shape, input_dtype)
File "/home/leo/anaconda2/lib/python2.7/site-packages/keras/engine/topology.py", line 370, in create_input_layer
self(x)
File "/home/leo/anaconda2/lib/python2.7/site-packages/keras/engine/topology.py", line 514, in call
self.add_inbound_node(inbound_layers, node_indices, tensor_indices)
File "/home/leo/anaconda2/lib/python2.7/site-packages/keras/engine/topology.py", line 572, in add_inbound_node
Node.create_node(self, inbound_layers, node_indices, tensor_indices)
File "/home/leo/anaconda2/lib/python2.7/site-packages/keras/engine/topology.py", line 149, in create_node
output_tensors = to_list(outbound_layer.call(input_tensors[0], mask=input_masks[0]))
File "/home/leo/anaconda2/lib/python2.7/site-packages/keras/layers/convolutional.py", line 466, in call
filter_shape=self.W_shape)
File "/home/leo/anaconda2/lib/python2.7/site-packages/keras/backend/tensorflow_backend.py", line 1639, in conv2d
x = tf.nn.conv2d(x, kernel, strides, padding=padding)
File "/home/leo/anaconda2/lib/python2.7/site-packages/tensorflow/python/ops/gen_nn_ops.py", line 394, in conv2d
data_format=data_format, name=name)
File "/home/leo/anaconda2/lib/python2.7/site-packages/tensorflow/python/framework/op_def_library.py", line 703, in apply_op
op_def=op_def)
File "/home/leo/anaconda2/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 2312, in create_op
set_shapes_for_outputs(ret)
File "/home/leo/anaconda2/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 1704, in set_shapes_for_outputs
shapes = shape_func(op)
File "/home/leo/anaconda2/lib/python2.7/site-packages/tensorflow/python/framework/common_shapes.py", line 246, in conv2d_shape
padding)
File "/home/leo/anaconda2/lib/python2.7/site-packages/tensorflow/python/framework/common_shapes.py", line 184, in get2d_conv_output_size
(row_stride, col_stride), padding_type)
File "/home/leo/anaconda2/lib/python2.7/site-packages/tensorflow/python/framework/common_shapes.py", line 149, in get_conv_output_size
"Filter: %r Input: %r" % (filter_size, input_size))
ValueError: Filter must not be larger than the input: Filter: (5, 5) Input: (1, 28)
MissingInputError: Input 0 of the graph (indices start from 0), used to compute if{}(keras_learning_phase, Elemwise{true_div,no_inplace}.0, Pool{ignore_border=True, mode='max', ndim=2}.0), was not provided and not given a value. Use the Theano flag exception_verbosity='high', for more information on this error.
12000/12000 [==============================] - 11s
Origin_model Accuracy: 0.964333333333
Start training SVM...
cnn-svm Accuracy: 0.299333333333
Start training Random Forest...
cnn-rf Accuracy: 0.295833333333
Process finished with exit code 0
https://www.tensorflow.org/get_started/os_setup
Pip installation on Windows
TensorFlow supports only 64-bit Python 3.5 on Windows
Can you add please your remarks in English
Traceback (most recent call last):
File "", line 1, in
debugfile('H:/DeepLearning/cnn_minst_keras/cnn.py', wdir='H:/DeepLearning/cnn_minst_keras')
File "D:\Anaconda2\lib\site-packages\spyder\utils\site\sitecustomize.py", line 888, in debugfile
debugger.run("runfile(%r, args=%r, wdir=%r)" % (filename, args, wdir))
File "D:\Anaconda2\lib\bdb.py", line 400, in run
exec cmd in globals, locals
File "", line 1, in
File "D:\Anaconda2\lib\site-packages\spyder\utils\site\sitecustomize.py", line 866, in runfile
execfile(filename, namespace)
File "D:\Anaconda2\lib\site-packages\spyder\utils\site\sitecustomize.py", line 87, in execfile
exec(compile(scripttext, filename, 'exec'), glob, loc)
File "h:/deeplearning/cnn_minst_keras/cnn.py", line 9, in
'''
File "D:\Anaconda2\lib\site-packages\keras\models.py", line 308, in add
output_tensor = layer(self.outputs[0])
File "D:\Anaconda2\lib\site-packages\keras\engine\topology.py", line 487, in call
self.build(input_shapes[0])
File "D:\Anaconda2\lib\site-packages\keras\layers\core.py", line 695, in build
name='{}_W'.format(self.name))
File "D:\Anaconda2\lib\site-packages\keras\initializations.py", line 36, in normal
return K.random_normal_variable(shape, 0.0, scale, name=name)
File "D:\Anaconda2\lib\site-packages\keras\backend\theano_backend.py", line 145, in random_normal_variable
return variable(np.random.normal(loc=0.0, scale=scale, size=shape),
File "mtrand.pyx", line 1903, in mtrand.RandomState.normal (numpy\random\mtrand\mtrand.c:18479)
File "mtrand.pyx", line 234, in mtrand.cont2_array_sc (numpy\random\mtrand\mtrand.c:3092)
ValueError: negative dimensions are not allowed
machine learning good?
What is issue and how to add issue?
from theano.tensor.signal import downsample
这个downsample是不是移动到其他位置了,小白一只,望告知~
你好,我对SMO的SVM的代码稍微有一点疑惑,就是关于权重系统$w$的计算的地方,如果核不是线性核,而是高斯核的时候,计算$g(x)$的时候直接用$y*X$是不是不太正确,应该加上核的运算?
谢谢指导
I think you have forgot set "input shape" in '"dive_into_keras/cnn.py"
L0CV is a new generation of computer vision open source online learning media, a cross-platform interactive learning framework integrating graphics, source code and HTML. the L0CV ecosystem — Notebook, Datasets, Source Code, and from Diving-in to Advanced — as well as the L0CV Hub.
楼主知道哪有吗?
看了您的《朴素贝叶斯理论推导与三种常见模型》,觉得是网上我找到的写的最不错的一篇。希望保存下来做个笔记什么的。无奈CSDN博客无法导出PDF,复制粘贴出来里面的公式也就都乱套了。
无奈来你github下面留言。
望成全~
拜谢!
def _createTree(self,X,y,featureIndex):
有一个返回分支 #所有label都相同的话,则停止分割,返回该label
if labelList.count(labelList[0]) == len(labelList):
return labelList[0]
当输入数据所有的类别都相同的时候,myTree 被y值覆盖了。
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.