Mar
08

credit flawed detection kaggle dataset

  1. base line: use all the attributes, tree algorithm, cross-validation parameter 3: 
      true 0 true 1 class precision
    pred. 0 284253 132 99.95%
    pred. 1 62 360 85.31%
    class recall 99.98% 73.17%  
    PerformanceVector:
    accuracy: 99.93% +/- 0.01% (mikro: 99.93%)
    ConfusionMatrix:
    True:	0	1
    0:	284253	132
    1:	62	360
    precision: 85.68% +/- 6.02% (mikro: 85.31%) (positive class: 1)
    ConfusionMatrix:
    True:	0	1
    0:	284253	132
    1:	62	360
    recall: 73.14% +/- 6.06% (mikro: 73.17%) (positive class: 1)
    ConfusionMatrix:
    True:	0	1
    0:	284253	132
    1:	62	360
    AUC (optimistic): 0.965 +/- 0.028 (mikro: 0.965) (positive class: 1)
    AUC: 0.858 +/- 0.035 (mikro: 0.858) (positive class: 1)
    AUC (pessimistic): 0.752 +/- 0.057 (mikro: 0.752) (positive class: 1)
    
    
    Use random forest tree:
    PerformanceVector:
    accuracy: 99.87% +/- 0.01% (mikro: 99.87%)
    ConfusionMatrix:
    True:	0	1
    0:	284298	342
    1:	17	150
    precision: 93.21% +/- 7.43% (mikro: 89.82%) (positive class: 1)
    ConfusionMatrix:
    True:	0	1
    0:	284298	342
    1:	17	150
    recall: 30.47% +/- 12.44% (mikro: 30.49%) (positive class: 1)
    ConfusionMatrix:
    True:	0	1
    0:	284298	342
    1:	17	150
    AUC (optimistic): 0.992 +/- 0.010 (mikro: 0.992) (positive class: 1)
    AUC: 0.852 +/- 0.039 (mikro: 0.852) (positive class: 1)
    AUC (pessimistic): 0.713 +/- 0.081 (mikro: 0.713) (positive class: 1)
  2. use selected attributes: time, v1,v2,v3, amount, class

    PerformanceVector

    PerformanceVector:
    accuracy: 99.84% +/- 0.01% (mikro: 99.84%)
    ConfusionMatrix:
    True:	0	1
    0:	284310	456
    1:	5	36
    precision: 93.00% +/- 11.40% (mikro: 87.80%) (positive class: 1)
    ConfusionMatrix:
    True:	0	1
    0:	284310	456
    1:	5	36
    recall: 7.34% +/- 4.55% (mikro: 7.32%) (positive class: 1)
    ConfusionMatrix:
    True:	0	1
    0:	284310	456
    1:	5	36
    AUC (optimistic): 0.998 +/- 0.006 (mikro: 0.998) (positive class: 1)
    AUC: 0.537 +/- 0.024 (mikro: 0.537) (positive class: 1)
    AUC (pessimistic): 0.075 +/- 0.044 (mikro: 0.075) (positive class: 1)
  3. select v1,v2,v3

    PerformanceVector

    PerformanceVector:
    accuracy: 99.85% +/- 0.01% (mikro: 99.85%)
    ConfusionMatrix:
    True:	0	1
    0:	284295	408
    1:	20	84
    precision: 81.93% +/- 12.69% (mikro: 80.77%) (positive class: 1)
    ConfusionMatrix:
    True:	0	1
    0:	284295	408
    1:	20	84
    recall: 17.08% +/- 5.20% (mikro: 17.07%) (positive class: 1)
    ConfusionMatrix:
    True:	0	1
    0:	284295	408
    1:	20	84
    AUC (optimistic): 0.992 +/- 0.010 (mikro: 0.992) (positive class: 1)
    AUC: 0.586 +/- 0.026 (mikro: 0.586) (positive class: 1)
    AUC (pessimistic): 0.181 +/- 0.055 (mikro: 0.181) (positive class: 1)
Feb
26

pycharm for django and sass

For django:

professional version.

  1. create a new django project: just create a new one
  2. import a django project:
    1. import the project
    2. activate django support

For Sass:

https://www.jetbrains.com/help/pycharm/2016.3/transpiling-sass-less-and-scss-to-css.html

  1. make sure, the sass support is activate: File -> Setting -> Plugin
  2. install node.js: File -> Setting -> Plugin -> install jetbrain plugin
  3. install ruby: during the installation, don’t forget check the option “set path to default”
  4. open teminal to install sass: “gem install sass”
  5. create a file watcher: File -> setting ->tools -> file watcher -> add -> sass
  6. transpiling the code
Jan
03

magic tts code for console

var msg = new SpeechSynthesisUtterance(‘Hello World’);
window.speechSynthesis.speak(msg);

https://developers.google.com/web/updates/2014/01/Web-apps-that-talk-Introduction-to-the-Speech-Synthesis-API

Jan
03

Decode a famous website

Many news medien encode their paid text, but some of them has very simple encode mechanism. ๐Ÿ˜€

I wrote the following code to decode a famous webseite. 

Just copy following codes in the console, then, you will see the text.

JS Bin on jsbin.com

Guess, which medien? ๐Ÿ˜€

Have fun!

Dec
06

vitualbox share folder

  1. device sharefolder -> set your folder path in windows and set folder name
  2. ubuntu terminal:
    1. sudo mount -t vboxsf FOLDERNAME /PATH/OF/FOLDER

For example: 

Windows: share folder: name: share, path: c:???

Ubuntu: sudo mount -t vbox share home/ying/share

 

enable clipboard share:

sudo apt-get install virtualbox-guest-dkms

 


set the right to the share_folder

sudo adduser xxxxxxx vboxsf (XXX: your user name)

Dec
06

virtualbox unbuntu install softwares

install java
sudo apt-add-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer

install open-terminal-here
$ sudo apt-get update && sudo apt-get upgrade
$ sudo apt-get install nautilus
$ sudo apt-get install nautilus-actions
$ nautilus-actions-config-tool * activate the command

for the case the clipboard sharing in virtualbox doesn’t work

$ sudo apt-get install virtualbox-guest-dkms

Dec
06

virtual box static ip setting

  1. set nat
  2. set host-only adapter (please create a network in the general setting, so that you can choose one of them in your host-only setting)
  3. start ubuntu
  4. go to system-network -> host-only network
  5. set your static ip, netmask, (no gateway!!!)
  6. restart!!!

https://superuser.com/questions/1080675/set-virtualbox-network-for-ubuntu-16-04-client?newreg=342b80bd2fd34e448c2c74ff65865b3a

Nov
25

Cassandra, Python, R, Node.js

It is quite nice, that Cassandra has driver for Python, R and Node.js.

If you want to build a website with Cassandra DB which has also heavily scientific programming, I would suggest the following combination:

  1. Python Flask  or Django + Cassandra
  2. Python(ZeroMQ, zerorpc) + R(opencpu) + Nodejs + Cassandra
    https://ianhinsdale.com/post/communicating-between-nodejs-and-python/
    https://www.opencpu.org/

The first solution is easiest, but the second solution is more elegant since you can separate the Python, Cassandra, NodeJS in different server. Thus the advantages of Node.JS will be kept. Of course, you can also use the childprocess from nodejs to call the Python and R. 
http://www.sohamkamani.com/blog/2015/08/21/python-nodejs-comm/
https://github.com/extrabacon/python-shell

Oct
02

the most useful pycharm hotkey

ctrl + s : save all

ctrl + y : delete row

ctrl + b / ctrl + click: go to the source

 

Jun
07

The useful python libraries

contextlib.pyย : can include the object in “with” and keep the memory small.

py4j: call java from python