사이트가 꺼져서 ㅠ
2016-05-20 21:13:32

단어는 해석/번역이 될 수 있는 것이지 해석이 그 단어는 아니다.

이것은 언어 번역에서 두드러진 것 같다.

Behavior 는 행동 혹은 사전적의미로 번역 될 수 있는 것이지.

Behavior 가 그 사전적의미는 아니다. Behavior 는 Behavior 이고 번역은 그냥 번역이다. 이를 엮어서 문장 내에서 의미를 정확히 파악되면 문장이 번역 된 것이다. 이 역시 그 번역은 번역이고 영어문장은 영어 문장이다.

중요한 것일 수록 원본을 잘 가지고 있어야하며,

쉽다고 해도 정확한 의미를 곱씹어야 한다.

특히 그 말을 대가가 했다면 두말할 나위가 없다.

▼ more
데이터 분석시 알아두면 좋은 개념들
2016-05-17 22:58:02

The focus on the talk is causal inference, a big subject in econometrics. He covers:

Counterfactuals

What would have happened to the treated if they weren’t treated? Would they look like the control on average? Read more about counterfactuals within empirical testing.

Control group: 전부 같은데 약만 안 준 것.

Treatment group: drug? 나머지 영향을 제외 약만의 영향을 보고 싶다.

약을 안주면 건강 내려감. 그게 counter factual 이다. 점선이 treatment

treatment 해서 약을 주니까 관측은 건강이 유지가되는데,

약을 안줬으면 이렇게 내려갔을 것이라고 추측함.

Difference in Differences (DiD)

It’s not enough to look at before and after of the treatment, you need to adjust the treated by the control. The treatment may not be randomly assigned.

끝에서 차이가 얼마인가? 약을 안주면 이정도 일텐데..

약아주면 Control 그룹에서\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0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\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0 안좋아진 것만큼 Treatment 에서도 안좋아졌을것이니 이걸 측정하는게 맞다.

즉 Control 그룹의 차이 C2 - C1 가 Treatment Group 에서도 날테니 T2 - T1 을 보는게 아니라 T2 - (T1 - |(C2 - C1)|) 를 본다? 식이 맞는건가 아닌가;; 아무튼 뭐 그래도 실제로는 parallel trend assumption 이라고 해도 평행하지 않긴하다.

Regression Discontinuity

Cut-off or threshold above or below the treatment is applied. You can compare cases close to the (arbitrary) threshold to estimate the average treatment effect when randomization is not possible. Tune the threshold once you can model the causal relationship and play what-if’s (don’t leave randomization to chance). Read more on regression discontinuity design (RDD).

장학금 주면 성적 오르나? 공부 못하는, 잘하는 사람을 주면 애매함.

장학금 주면

한쪽만 줄수 밖에 없는데.. 그리고 성적이 오르는건가?

Cutoff 에서 discontinuity 가 생기면 개선된거다?

Natural Experiments

May or may not be randomized.

An example is the draft lottery.

이미 일어난 일을 분석? 콜레라 걸린 사람 안걸린 사람 어떤 물을 먹었는지를 가지고 알아냄..

죽은 사람점을 찍으니 몰려있다. 이미 발생한 현상인데 지도에 뿌려보니 몰려있다.

먹는 물이 다르다. 죽은 사람은 여기 살은 사람은 저기에서 먹음.

실험을 설계하는 것 아님! 현상에 대해서 그거를 실험으로 인과를 찾을 수 있는가?

Instrumental Variables

Variation in X that is independent of error.

Something that changes X (correlates with X) but does not change the error. Provides a control lever.

Randomization is an instrumental variable.

Z(IV) -(only)-> X -> Y ??

(통계를 내기 힘들때) 간접적으로 사용하는 값이 Instrumental Variable 이다.

예를 들면, 누가 담배를 피는지 안피는지를 알긴 어려우니..

담배 세금은 건강에 영향을 안주지만 담배 판매량을 통해서만 영향을 줄테니, 이 것으로 보겠다.

Confounding Variables(중간고사)

Unobserved variables that correlates with both x and y (the other stuff). Commonly an issue when human choice is involved.

주로 사람의 선택이 포함될 때의 이슈이다.

데이터에 포함되지 않는데 그요소가 영향을 줘서 causation 은 안된다.

--------------------------------------------------------------------------

He summarized the lessons for the machine learning community from econometrics as follows:

Observational data (usually) can’t determine causality, no matter how big it is (big data is not enough)

Causal inference is what you want for policy

Treatment-control with random assignment is the gold standard

Sometimes you can find natural experiments, discontinuities, etc.

Prediction is critical to causal inference for both selection issue and counterfactual

Very interesting research in systems for continual testing

ref: http://machinelearningmastery.com/lessons-for-machine-learning-from-econometrics/

▼ more
와중, 마중
2016-05-16 23:45:56

학기 마무리가 오는 와중에

나를 마중 나온 수 많은 것들

Cublas 는 이렇게 써먹으면 안 될듯;

그리고 특히 1번 !! 좀 자세히 봐야하고 나머지도 다시 읽어보자;

http://machinelearningmastery.com/lessons-for-machine-learning-from-econometrics/

http://mattturck.com/2012/06/29/a-chart-of-the-big-data-ecosystem/

https://medium.com/@shivon/the-current-state-of-machine-intelligence-f76c20db2fe1#.ca078trw0

https://www.oreilly.com/ideas/the-current-state-of-machine-intelligence-2-0

https://www.buzzfeed.com/williamalden/inside-palantir-silicon-valleys-most-secretive-company?utm_term=.jrzJ7ZJxL#.rjoJoKJ7q

▼ more
CuBlas VS Eigen Level1
2016-05-14 16:38:50

//Level1 V, V

//vec += vec1;

printf("CPU: Naive => vec += vec1

");

for(int i=0;i<SIZE;i++){ printf("%f ", vec[i] + vec1[i]);} printf("

");

printf("CPU: Eigen => vec += vec1

");

ei_vec.row(0) += ei_vec1.row(0);

for(int i=0;i<SIZE;i++){ printf("%f ", ei_vec.row(0).array().data()[i]);} printf("

");

memcpy(ei_vec.row(0).data(), vec, SIZE * sizeof(float));

memcpy(ei_vec1.row(0).data(), vec1, SIZE * sizeof(float));

memcpy(ei_vec2.row(0).data(), vec2, SIZE * sizeof(float));

printf("GPU: Cublas => vec += vec1

");

cublasSaxpy(handle, SIZE, &alpha, cu_vec1,1, cu_vec,1);

checkCudaErrors(cudaMemcpy(out_vec, cu_vec, SIZE * sizeof(float), cudaMemcpyDeviceToHost));

for(int i=0;i<SIZE;i++){ printf("%f ", out_vec[i]);} printf("

");

checkCudaErrors(cudaMemcpy(cu_vec, vec, SIZE * sizeof(float), cudaMemcpyHostToDevice));

checkCudaErrors(cudaMemcpy(cu_vec1, vec1, SIZE * sizeof(float), cudaMemcpyHostToDevice));

checkCudaErrors(cudaMemcpy(cu_vec2, vec2, SIZE * sizeof(float), cudaMemcpyHostToDevice));

printf("--------------------------------------------

");

//vec *= vec1; //elementwise multiplication

printf("CPU: Naive => vec *= vec1

");

for(int i=0;i<SIZE;i++){ printf("%f ", vec[i]*vec1[i]);} printf("

"); // CPU: Naive

printf("CPU: Eigen => vec *= vec1

");

ei_vec.row(0).array() *= ei_vec1.row(0).array();

for(int i=0;i<SIZE;i++){ printf("%f ", ei_vec.row(0).array().data()[i]);} printf("

"); //CPU: Eigen

memcpy(ei_vec.row(0).data(), vec, SIZE * sizeof(float));

memcpy(ei_vec1.row(0).data(), vec1, SIZE * sizeof(float));

memcpy(ei_vec2.row(0).data(), vec2, SIZE * sizeof(float));

printf("GPU: Cublas => vec *= vec1

");

//y = α op ( A ) x + β y

cublasSgemv(handle, CUBLAS_OP_T, 1, SIZE, &one, cu_vec, 1, cu_vec1, 1, &zero, cu_out_vec, 1); // 정상동작 안함!!!

checkCudaErrors(cudaMemcpy(out_vec, cu_out_vec, SIZE * sizeof(float), cudaMemcpyDeviceToHost));

for(int i=0;i<SIZE;i++){ printf("%f ", out_vec[i]);} printf("

"); // GPU: Cublas

checkCudaErrors(cudaMemcpy(cu_vec, vec, SIZE * sizeof(float), cudaMemcpyHostToDevice));

checkCudaErrors(cudaMemcpy(cu_vec1, vec1, SIZE * sizeof(float), cudaMemcpyHostToDevice));

checkCudaErrors(cudaMemcpy(cu_vec2, vec2, SIZE * sizeof(float), cudaMemcpyHostToDevice));

printf("--------------------------------------------

");

//vec = vec1 - vec2;

printf("CPU: Naive => vec = vec1 - vec2

");

for(int i=0;i<SIZE;i++){ printf("%f ", vec1[i]-vec2[i]);} printf("

");

printf("CPU: Eigen => vec = vec1 - vec2

");

ei_out_vec.row(0).noalias() = ei_vec1.row(0) - ei_vec2.row(0);

for(int i=0;i<SIZE;i++){ printf("%f ", ei_out_vec.row(0).data()[i]);} printf("

"); //CPU: Eigen

memcpy(ei_vec.row(0).data(), vec, SIZE * sizeof(float));

memcpy(ei_vec1.row(0).data(), vec1, SIZE * sizeof(float));

memcpy(ei_vec2.row(0).data(), vec2, SIZE * sizeof(float));

printf("GPU: Cublas => vec = vec1 - vec2

");

cublasSaxpy(handle, SIZE, &minus, cu_vec2,1, cu_vec1,1);

checkCudaErrors(cudaMemcpy(out_vec, cu_vec1, SIZE * sizeof(float), cudaMemcpyDeviceToHost));

for(int i=0;i<SIZE;i++){ printf("%f ", out_vec[i]);} printf("

");

checkCudaErrors(cudaMemcpy(cu_vec, vec, SIZE * sizeof(float), cudaMemcpyHostToDevice));

checkCu\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0daErrors(cudaMemcpy(cu_vec1, vec1, SIZE * sizeof(float), cudaMemcpyHostToDevice));

checkCudaErrors(cudaMemcpy(cu_vec2, vec2, SIZE * sizeof(float), cudaMemcpyHostToDevice));

printf("--------------------------------------------

");

//vec = vec1.cwiseProduct(vec2);

printf("CPU: Naive => vec = vec1.cwiseProduct(vec2)

");

for(int i=0;i<SIZE;i++){ printf("%f ", vec1[i]*vec2[i]);} printf("

"); // CPU: Naive

printf("CPU: Eigen => vec = vec1.cwiseProduct(vec2)

");

ei_vec.row(0).row(0).noalias() = ei_vec1.row(0).cwiseProduct(ei_vec2.row(0));

for(int i=0;i<SIZE;i++){ printf("%f ", ei_vec.row(0).row(0).data()[i]);} printf("

"); //CPU: Eigen

memcpy(ei_vec.row(0).data(), vec, SIZE * sizeof(float));

memcpy(ei_vec1.row(0).data(), vec1, SIZE * sizeof(float));

memcpy(ei_vec2.row(0).data(), vec2, SIZE * sizeof(float));

printf("--------------------------------------------

");

▼ more