Hey Hey Hey


  • Home

  • Archives

  • Tags

  • Search

Machine Learning - Week 2

Posted on 2017-12-20 |

https://www.coursera.org/learn/machine-learning/home/week/2

Multivariate Linear Regression

上周学的是单个参数的Linear Regression, 模型中只有一个变量x。Multivariate Linear Regression是,

$h_\theta (x) = \theta_0 + \theta_1 x_1 + \theta_2 x_2 + \theta_3 x_3 + \cdots + \theta_n x_n$

具体描述:

$\begin{align*}x_j^{(i)} &= \text{value of feature } j \text{ in the }i^{th}\text{ training example} \newline x^{(i)}& = \text{the input (features) of the }i^{th}\text{ training example} \newline m &= \text{the number of training examples} \newline n &= \text{the number of features} \end{align*}$

适用Matrix表示就变成,

$\begin{align*}h_\theta(x) =\begin{bmatrix}\theta_0 \hspace{2em} \theta_1 \hspace{2em} ... \hspace{2em} \theta_n\end{bmatrix}\begin{bmatrix}x_0 \newline x_1 \newline \vdots \newline x_n\end{bmatrix}= \theta^T x\end{align*}$

其中,

$x_{0}^{(i)} =1 \text{ for } (i\in { 1,\dots, m } )$
Read more »

JDK or JRE?

Posted on 2017-11-18 |

https://serverfault.com/questions/372997/why-jdk-is-installed-with-web-application-servers

What’s the differnce between using JDK and JRE?

The requirement of JDK or JRE is dependent on the particular application server itself. (e.g JBOSS, tomcat, glassfish, etc), and its strategies for compiling to bytecode, and how it decides on its dependencies at start-up.

In a strict sense if your java application just executes Java byte code in the form of classes, then you should be able to get away with just a JRE. However whether this is true or not depends on the Java App server strategy to either check for an installed JDK defensively at start-up, or just throw an exception at some point when compilation is requested.

Some application servers use the javac to compile jsp to class files and hence are dependent on having a system JDK installed, this can be contrasted with say tomcat, which bundles its own compiler for jsps, hence can run under the JRE.

The java keystore is a feature of the Java SE, and both openJDK and Hotspot reference a file
JAVA_HOME/lib/security/java.security
to select their defaults.

Unless you have changed $JAVA_HOME/lib/security/java.security, the default keystore.type=jks file implementation looks for $HOME/.keystore hence its up to you to over ride the location, and both the 1.5 and 1.6 version of the sunJDK use that format and default location.

so basically changing $JAVA_HOME wont effect the location of the keystore

(unless you have actually over ridden the keystore location into the $JAVA_HOME folder…)

but it might matter if you are using some non-default provider, or have set some non-default options in java.security.

Read more »

Flink

Posted on 2017-11-11 |

setup the IDE

https://ci.apache.org/projects/flink/flink-docs-release-1.3/quickstart/java_api_quickstart.html

1
2
3
4
$ mvn archetype:generate                               \
-DarchetypeGroupId=org.apache.flink \
-DarchetypeArtifactId=flink-quickstart-java \
-DarchetypeVersion=1.3.2

Providing the value of

1
2
3
4
5
6
Define value for property 'groupId': learn.rachel.flink
Define value for property 'artifactId': flinksamples
Define value for property 'version' 1.0-SNAPSHOT: : 0.1
Define value for property 'package' learn.rachel.flink: :
Confirm properties configuration:
groupId: learn.rachel.flink

This command should run under the folder where the source code parent folder not exist.
For example, run under D:\workspaces
Then, after the cmd run , the project root will be D:\workspaces\flinksamples

Read more »

Machine Learning - Week 1

Posted on 2017-09-24 |

https://www.coursera.org/learn/c/lecture/RKFpn/welcome

Overview

Example of machine Learning

  • Database mining
  • Application can’t program by Hand
  • Self-customizing programs
  • Understanding Human Learning (Brain, Real AI)

What is Machine Learning

Two definitions of Machine Learning are offered.

  • Tom Mitchell provides a more modern definition: “A computer program is said to learn from experience E with respect to some class of tasks T and performance measure P, if its performance at tasks in T, as measured by P, improves with experience E.”

Example: playing checkers.

E = the experience of playing many games of checkers

T = the task of playing checkers.

Read more »

keytool

Posted on 2017-08-09 |

p12

  • list p12 contents then extract certificate from p12
1
2
keytool -v -list -storetype pkcs12 -keystore KEYSTORE_ABSOLUTE_PATH.p12
keytool -exportcert -keystore KEYSTORE_ABSOLUTE_PATH.p12 -storetype PKCS12 -storepass KEYSTORE_PASSWORD -alias ALIAS -file EXPORTED_CERT_NAME.crt
Read more »

Certificates Related

Posted on 2017-08-05 |

Certificates

What is SSL certificate Chain

https://support.dnsimple.com/articles/what-is-ssl-certificate-chain/

intermediate CA

Storage of Keys and Certificates

https://en.wikipedia.org/wiki/PKCS_12

  • .p12

    corresponding tool is openssl

  • .pfx

    microsoft version

  • .pem

    lists the certificates and possibly private keys as Base 64 strings in a text file

list of all kinds of files and contents

https://blogs.msdn.microsoft.com/kaushal/2010/11/04/various-ssltls-certificate-file-typesextensions/

Read more »

Java JCE

Posted on 2017-08-03 |

Background

http://docs.oracle.com/javase/7/docs/technotes/guides/security/SunProviders.html

http://dino.ciuffetti.info/2016/04/how-to-check-if-jce-unlimited-strength-policy-is-installed/

Checking JCE using Java command line

Here is the command used to check JCE strength on windows. The output should be >=256

1
2
3
4
5
6
7
jrunscript -e "print (javax.crypto.Cipher.getMaxAllowedKeyLength('AES'));"
jrunscript -e "print (javax.crypto.Cipher.getMaxAllowedKeyLength('DES'));"
jrunscript -e "print (javax.crypto.Cipher.getMaxAllowedKeyLength('DESede'));"
jrunscript -e "print (javax.crypto.Cipher.getMaxAllowedKeyLength('RC2'));"
jrunscript -e "print (javax.crypto.Cipher.getMaxAllowedKeyLength('RC4'));"
jrunscript -e "print (javax.crypto.Cipher.getMaxAllowedKeyLength('RSA'));"
jrunscript -e "print (javax.crypto.Cipher.getMaxAllowedKeyLength('RC5'));"

Example of result on windows where JCE is configured

1
2
3
4
5
6
7
8
9
10
11
12
13
14
C:\java\jdk1.8.0_91\bin>jrunscript -e "print (javax.crypto.Cipher.getMaxAllowedKeyLength('AES'));"
2147483647
C:\java\jdk1.8.0_91\bin>jrunscript -e "print (javax.crypto.Cipher.getMaxAllowedKeyLength('DES'));"
2147483647
C:\java\jdk1.8.0_91\bin>jrunscript -e "print (javax.crypto.Cipher.getMaxAllowedKeyLength('DESede'));"
2147483647
C:\java\jdk1.8.0_91\bin>jrunscript -e "print (javax.crypto.Cipher.getMaxAllowedKeyLength('RC2'));"
2147483647
C:\java\jdk1.8.0_91\bin>jrunscript -e "print (javax.crypto.Cipher.getMaxAllowedKeyLength('RC4'));"
2147483647
C:\java\jdk1.8.0_91\bin>jrunscript -e "print (javax.crypto.Cipher.getMaxAllowedKeyLength('RSA'));"
2147483647
C:\java\jdk1.8.0_91\bin>jrunscript -e "print (javax.crypto.Cipher.getMaxAllowedKeyLength('RC5'));"
2147483647

Same command can be used on linux to check. Just make sure the jrunscript is triggerred using the one under the <JRE/JDK_home>bin you want to check.

Read more »

Ansible

Posted on 2017-07-20 |

setup ansible

http://docs.ansible.com/ansible/latest/intro_getting_started.html

setup and ping all the hosts

To set up the ssh

  1. generate key pair
1
ssh-keygen -t rsa -f /<path-to-key>/authorized_keys.myuserid
  • After this command, we should get one pair of keys
  • myuserid should be the user exist on all the target servers and have access
  1. add private key to ssh-client on control box
1
2
ssh-agent bash
ssh-add /<path-to-key>/authorized_keys.myuserid
  1. list all hosts into /etc/ansible/hosts file

  2. using myuserid to log in control machine, and start triggerring command

Read more »

Java Code Style

Posted on 2017-07-12 |

Reference Standard

Google Java style

https://google.github.io/styleguide/javaguide.html

  • Source files are encoded in UTF-8.

  • Tab characters are not used for indentation; use two spaces

  • A source file consists of, in order:

  • License or copyright information, if present

  • Package statement

  • Import statements

no wildcard imports

  • Exactly one top-level class

never split overloads classes
always use braces for if,else,for,do and while
style of braces

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
return () -> {
while (condition()) {
method();
}
};

return new MyClass() {
@Override public void method() {
if (condition()) {
try {
something();
} catch (ProblemException e) {
recover();
}
} else if (otherCondition()) {
somethingElse();
} else {
lastThing();
}
}
};

line-wrapping normally at 100, but there are exceptions; wrapped lines indent 4+ spaces

  • Exactly one blank line separates each section that is present
Read more »

Postgres database common

Posted on 2017-07-10 |

login database

1
2
3
4
5
6
[root@postgres-server01 keytabs]# psql ambari ambari
Password for user ambari:
psql (9.2.18)
Type "help" for help.

ambari=#
Read more »
1…121314…18
Rachel Rui Liu

Rachel Rui Liu

178 posts
193 tags
RSS
GitHub Linkedin
© 2021 Rachel Rui Liu
Powered by Hexo
Theme - NexT.Pisces
0%