环境:win10
1.安装tensorflow,下载官方的whl文件就行了,需要保证Python的版本是3.5,Anaconda3-4.2.0-Windows-x86_64是可以的
2.安装theano,需要conda install libpython ,会在C:\Anaconda3\libs下生成libpython35.dll.a文件,然后pip install keras 之后,会自动安装theano
Tuesday, March 14, 2017
Monday, February 20, 2017
liblinear使用
http://u.cs.biu.ac.il/~89-680/liblinear/using_liblinear.html
http://u.cs.biu.ac.il/~89-680/liblinear/liblin.py
看了上面的这篇介绍liblinear的文章,真是写的通俗易懂,更加深了自己对这个库的理解。进去网站,发现文字看不懂啊,百度了一下“巴伊兰大学1955年建于拉马特甘,是目前以色列第二大的学术机构。”
http://u.cs.biu.ac.il/~89-680/liblinear/liblin.py
看了上面的这篇介绍liblinear的文章,真是写的通俗易懂,更加深了自己对这个库的理解。进去网站,发现文字看不懂啊,百度了一下“巴伊兰大学1955年建于拉马特甘,是目前以色列第二大的学术机构。”
其中关于C惩罚
c越大越容易过拟合
c越小越容易欠拟合
关于惩罚项的具体公式和推倒还是要好好看看。
Q: How to select the regularization parameter C?
关于惩罚项的具体公式和推倒还是要好好看看。
Q: How to select the regularization parameter C?
After version 2.0, an option -C is provided to find C. For example, you can run
> train -C data_fileto find the C value with the best CV rate.
还有这篇文章
http://dataunion.org/15669.html
C和σ2对SVM的影响:
- C较大(λ较小)时,可能会过拟合(Low bias, high variance);
- C较小(λ较大)时,可能会欠拟合(High bias, low variance);
- σ2较大时,High bias, low variance;
- σ2较小时,Low bias, high variance;
Sunday, February 19, 2017
记录ConfigParser在Python2.6下一坑
import ConfigParser
import codecs
import os
#category_cfg_file="category.cfg"
category_cfg = ConfigParser.ConfigParser()
with codecs.open('feature_common.config', 'r',encoding='utf-8') as configfile:
category_cfg.readfp(configfile)
features = category_cfg.sections()
上面代码在Python2.7下,返回的features顺序和配置文件中的顺序是一样的,可是服务器用的是Python2.7,这个返回的竟然是无序的,查到了很久才查到这一块。我草快被坑死了。
http://stackoverflow.com/questions/1134071/keep-configparser-output-files-sorted
找到答案,修复方法如下
In Python 2.7, you can
import codecs
import os
#category_cfg_file="category.cfg"
category_cfg = ConfigParser.ConfigParser()
with codecs.open('feature_common.config', 'r',encoding='utf-8') as configfile:
category_cfg.readfp(configfile)
features = category_cfg.sections()
上面代码在Python2.7下,返回的features顺序和配置文件中的顺序是一样的,可是服务器用的是Python2.7,这个返回的竟然是无序的,查到了很久才查到这一块。我草快被坑死了。
http://stackoverflow.com/questions/1134071/keep-configparser-output-files-sorted
找到答案,修复方法如下
In Python 2.7, you can
from collections import OrderedDict and use ConfigParser(dict_type=OrderedDict) to make the parser use an ordered dictionary. Based on a minimal amount of testing, I think this should serve you well.
Wednesday, February 15, 2017
shell传参
http://stackoverflow.com/questions/415677/how-to-replace-placeholders-in-a-text-file
https://my.oschina.net/iuranus/blog/279985
https://my.oschina.net/iuranus/blog/279985
Monday, February 13, 2017
安装mysqldb
##centos 环境
sudo yum install mysql-devel
sudo pip install mysql-python
##ubuntu环境
sudo yum install mysql-devel
sudo pip install mysql-python
##ubuntu环境
Starting with a vanilla Lucid install [1], install pip and upgrade to the latest version:
apt-get install python-pip
pip install -U pip
Next, install the required development packages:
apt-get install python-dev libmysqlclient-dev
then
pip install MySQL-python
should complete successfully.
mac下安装
$ brew uninstall mysql
$ brew install mysql-connector-c
$ brew unlink mysql-connector-c
$ brew install mysql
$ pip install mysql-python
mac下安装
$ brew uninstall mysql
$ brew install mysql-connector-c
$ brew unlink mysql-connector-c
$ brew install mysql
$ pip install mysql-python
Saturday, January 7, 2017
scala 第一深坑
http://stackoverflow.com/questions/23722048/intellij-idea-13-new-scala-sbt-project-hasnt-src-directory-structure-generated
2.intellij 打开终端terminal
alt+f12
2.intellij 打开终端terminal
alt+f12
Thursday, January 5, 2017
redis-py-cluster一坑记录
按照文档例子来一发,发现错误呀,单用redis-py错误呀
>>> from rediscluster import StrictRedisCluster >>> # Requires at least one node for cluster discovery. Multiple nodes is recommended. >>> startup_nodes = [{"host": "127.0.0.1", "port": "7000"}] >>> # Note: decode_responses must be set to True when used with python3 >>> rc = StrictRedisCluster(startup_nodes=startup_nodes, decode_responses=True) >>> rc.set("foo", "bar") True >>> print(rc.get("foo")) 'bar'
cluster错误如下:
ResponseError: unknown command 'CONFIG'
想死有没有,各种找不到答案
https://www.digitalocean.com/community/tutorials/how-to-secure-your-redis-installation-on-ubuntu-14-04
看到这篇文章,原来server可以选择屏蔽一些命令的,然后,搜索redis-py-cluster源码,找到这么一句
If your redis instance is configured to not have the `CONFIG ...` comannds enabled due to security reasons you need to pass this into the client object `skip_full_coverage_check=True`. Benefits is that the client class no longer requires the `CONFIG ...` commands to be enabled on the server. Downsides is that you can't use the option in your redis server and still use the same feature in this client.
加了一个skip_full_coverage_check=True搞定
Subscribe to:
Posts (Atom)