Saturday, April 22, 2017

intellij idea 打开多个project

http://blog.csdn.net/zht666/article/details/47831893

Java执行jar包方式

http://www.cnblogs.com/adolfmc/archive/2012/10/07/2713562.html


用OneJar打包后Java -jar ****.jar总是运行指定的主方法,现在工程中有很多其他的主方法,想要运行指定的。可以用下面的命令:

java -classpath ****.jar ****.****.className [args]
2

Thursday, April 6, 2017

python 添加自己开发的模块

  1. 定位模块文件地址的方法
import codecs
codecs.__file__

打印Python系统路径
import sys
sys.path

  1. 添加自己的模块

here are a few ways. One of the simplest is to create a my-paths.pth file (as described here). This is just a file with the extension .pth that you put into your system site-packages

在site-packages中添加一个文件my-paths.pth,其中pth文件中添加自己的模块地址就行了




扩展 Python的内置函数

Tuesday, March 28, 2017

hive 表及其文件被删除恢复

1.关于hive外部表和内部表的差异,可以查看
http://stackoverflow.com/questions/38318513/does-drop-partition-delete-data-from-external-table-in-hive

大概意思就是内部表,表被drop掉之后,文件也会被删除。

我就是建立了内部表,然后把表drop了,然后文件也被删除了,恢复的办法就是/user/<user>/.Trash 去拷贝或者mv出来,因为我的操作用户是root,对应的user换成root就可以了

具体参见http://stackoverflow.com/questions/20114597/hive-files-on-hdfs-not-being-deleted-when-managed-not-external-table-is-droppe

2.因为通过spark streaming 读取kafka里的反馈日志,并且写入hdfs,文件是orc文件的
CREATE EXTERNAL TABLE test (
    foo string,
    time string,
    bar string
)  PARTITIONED BY (dt string)
ROW FORMAT DELIMITED
FIELDS TERMINATED BY '\t'
LOCATION 's3://test.com/';
建表方式如上,当然,orcfile的terminated by ',',另外需要加上一句STORED AS ORC就可以了
然后每天的天分区需要这样加载进去,才能被查询到
LTER TABLE test
    ADD PARTITION (dt='2014-03-05')
    location 's3://test.com/2014-03-05'

方法参考http://stackoverflow.com/questions/22220837/how-to-add-partition-using-hive-by-a-specific-date



ref
https://www.cloudera.com/documentation/enterprise/5-8-x/topics/impala_alter_table.html
https://cwiki.apache.org/confluence/display/Hive/LanguageManual+DDL

Tuesday, March 14, 2017

安装keras,tensorflow,theano

环境: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

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年建于拉马特甘,是目前以色列第二大的学术机构。”


其中关于C惩罚

c越大越容易过拟合
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_file  
to 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;