-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathatom.xml
More file actions
694 lines (552 loc) · 33.3 KB
/
atom.xml
File metadata and controls
694 lines (552 loc) · 33.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title><![CDATA[STATKWON]]></title>
<link href="http://Jaimyoung.github.io/atom.xml" rel="self"/>
<link href="http://Jaimyoung.github.io/"/>
<updated>2014-09-22T16:39:57-07:00</updated>
<id>http://Jaimyoung.github.io/</id>
<author>
<name><![CDATA[Jaimyoung Kwon]]></name>
</author>
<generator uri="http://octopress.org/">Octopress</generator>
<entry>
<title type="html"><![CDATA[Data Science Toolchain (DSTC)]]></title>
<link href="http://Jaimyoung.github.io/blog/2014/09/21/data-science-toolchain/"/>
<updated>2014-09-21T20:12:04-07:00</updated>
<id>http://Jaimyoung.github.io/blog/2014/09/21/data-science-toolchain</id>
<content type="html"><![CDATA[<p>Here’re components of data science toolchain, not in partiular order:</p>
<ol>
<li><strong>Bare basic</strong>
<ol>
<li>OSX / Linux.</li>
<li><a href="http://support.apple.com/kb/ht1343">Speed</a>, <a href="http://ss64.com/bash/syntax-keyboard.html">speed</a>, speed.</li>
<li>ssh. <a href="https://news.ycombinator.com/item?id=1938884">ssh-copy-id</a>.</li>
<li>bash / <a href="https://github.com/robbyrussell/oh-my-zsh">zsh</a> / <a href="http://dotfiles.github.io/">Dotfiles management</a></li>
<li>git. <a href="https://bitbucket.org/">Bitbucket</a> / <a href="https://github.com/">Github</a></li>
<li><a href="https://pages.github.com/">Git Pages</a></li>
</ol>
</li>
<li><strong>RStudio</strong>
<ol>
<li><a href="https://google-styleguide.googlecode.com/svn/trunk/Rguide.xml">Google’s R style guide</a></li>
<li><a href="http://r-pkgs.had.co.nz/style.html">Hadley Wickham R style guide</a></li>
</ol>
</li>
<li><strong>Sublime</strong> text editor
<ol>
<li>Read <a href="https://developers.google.com/web/fundamentals/tools/setup/editor">This</a> and <a href="http://robdodson.me/blog/2012/06/23/sublime-text-2-tips-and-shortcuts/">that</a></li>
</ol>
</li>
<li><strong>Python</strong>
<ol>
<li>Easy route: <a href="http://continuum.io/downloads">Anaconda distribution</a> with entire <a href="http://www.scipy.org/">SciPy</a> stack</li>
<li><a href="https://developers.google.com/edu/python/introduction">Intro python</a></li>
<li><a href="https://github.com/konstantint/python-boilerplate-template">Boilerplate for larger projects</a></li>
<li>Style guide and pylint. See <a href="https://google-styleguide.googlecode.com/svn/trunk/pyguide.html">Google’s Python style guide</a>
<blockquote><p>Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live.
<cite>Quoted by Damin Conway in <a href="http://stackoverflow.com/questions/876089/who-wrote-this-programing-saying-always-code-as-if-the-guy-who-ends-up-maintai">Perl Best Practices</a></cite></p></blockquote></li>
</ol>
</li>
<li><strong>Machine learning</strong> / classification / regression
<ol>
<li>“Elements of Statistical Learning”</li>
<li>Lasso</li>
<li>Lasso w/ large data.</li>
<li>Random forest.</li>
<li>Best practices.</li>
<li>ROC.</li>
</ol>
</li>
<li><strong>Data Visualization</strong>
<ol>
<li><a href="ggplot2.org">ggplot2</a>. <a href="http://courses.had.co.nz/11-rice/">plyr</a></li>
<li><a href="http://d3js.org/">d3.js</a>, if feeling geeky.</li>
</ol>
</li>
<li>Feature reduction.
<ol>
<li>Principal component</li>
<li>SVD</li>
</ol>
</li>
<li><strong>VW or [Vowpal Wabbit]</strong>(<a href="https://github.com/JohnLangford/vowpal_wabbit/wiki">https://github.com/JohnLangford/vowpal_wabbit/wiki</a>)</li>
<li><strong>SQL</strong></li>
<li><strong>Hadoop MapReduce</strong>
<ol>
<li>AWS EMR</li>
</ol>
</li>
<li><strong><a href="https://www.google.com/search?q=Reproducible+and+Collaborative+Data+Science&oq=Reproducible+and+Collaborative+Data+Science&aqs=chrome..69i57j69i61.407j0j4&sourceid=chrome&es_sm=91&ie=UTF-8">Reproduciblile and collaborative data science</a></strong>
<ol>
<li><a href="http://berkeleysciencereview.com/reproducible-collaborative-data-science/">The Berkeley Science Review</a>,</li>
<li><a href="https://github.com/stat157/fall-2013/blob/master/topic-sketch.md">“STAT 157” topics</a>.</li>
<li>Repeatability</li>
</ol>
</li>
<li><strong>“Some” web programming</strong> if you’re geeky:
<ol>
<li><a href="https://developers.google.com/web/fundamentals/">Web Fundamentals</a>, for multi device development</li>
<li><a href="https://angularjs.org/">AngularJS</a>, a JavaScript MVW Framework</li>
<li><a href="http://flask.pocoo.org/">Flask</a>, a microframework for Python</li>
<li><a href="http://ionicframework.com/">Ionic</a>, a front-end framework for developing hybrid mobile apps with HTML5.</li>
</ol>
</li>
</ol>
]]></content>
</entry>
<entry>
<title type="html"><![CDATA[Sublime Text Editor]]></title>
<link href="http://Jaimyoung.github.io/blog/2014/09/21/sublime-text-editor/"/>
<updated>2014-09-21T01:14:36-07:00</updated>
<id>http://Jaimyoung.github.io/blog/2014/09/21/sublime-text-editor</id>
<content type="html"><![CDATA[<p>To start, first download sublime text 3.
Then install a few useful packages:</p>
<ol>
<li>Install package control</li>
<li>Install bunch of packages:
<ol>
<li>sublimelinter</li>
<li>sublimelinter-pylint (see below)</li>
<li>markdown-extended</li>
<li>monokai-extended (and enable it)</li>
<li>git gutter</li>
</ol>
</li>
</ol>
<p>Default settings work well, but one might want to change the “user” setting
for handling tabs:</p>
<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
</pre></td><td class='code'><pre><code class='js'><span class='line'><span class="s2">"translate_tabs_to_spaces"</span><span class="o">:</span> <span class="kc">true</span>
</span><span class='line'><span class="s2">"tab_size"</span><span class="o">:</span> <span class="mi">4</span><span class="p">,</span>
</span><span class='line'><span class="s2">"detect_indentation"</span><span class="o">:</span> <span class="kc">true</span><span class="p">,</span>
</span></code></pre></td></tr></table></div></figure>
<p>Syntax specific changes in tab_size is also useful. For *.R for example:
<code>"tab_size": 2,</code></p>
<h3>Sublimelinter + pylint + anaconda python on Mac OSX conundrum</h3>
<p>Mac OSX Path for python in sublime is messed up by default.
Default pylint install leads to:</p>
<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
<span class='line-number'>10</span>
<span class='line-number'>11</span>
</pre></td><td class='code'><pre><code class='bash'><span class='line'>SublimeLinter: WARNING: no pylint version could be extracted from:
</span><span class='line'>Traceback <span class="o">(</span>most recent call last<span class="o">)</span>:
</span><span class='line'> File <span class="s2">"/usr/local/bin/pylint"</span>, line 5, in <module>
</span><span class='line'> from pkg_resources import load_entry_point
</span><span class='line'> File <span class="s2">"/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py"</span>, line 2603, in <module>
</span><span class='line'> working_set.require<span class="o">(</span>__requires__<span class="o">)</span>
</span><span class='line'> File <span class="s2">"/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py"</span>, line 666, in require
</span><span class='line'> <span class="nv">needed</span> <span class="o">=</span> self.resolve<span class="o">(</span>parse_requirements<span class="o">(</span>requirements<span class="o">))</span>
</span><span class='line'> File <span class="s2">"/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py"</span>, line 565, in resolve
</span><span class='line'> raise DistributionNotFound<span class="o">(</span>req<span class="o">)</span> <span class="c"># XXX put more info here</span>
</span><span class='line'>pkg_resources.DistributionNotFound: <span class="nv">pylint</span><span class="o">==</span>1.3.1
</span></code></pre></td></tr></table></div></figure>
<p>Add the following to sublimelinter-user to fix it:</p>
<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
<span class='line-number'>10</span>
<span class='line-number'>11</span>
<span class='line-number'>12</span>
<span class='line-number'>13</span>
<span class='line-number'>14</span>
<span class='line-number'>15</span>
<span class='line-number'>16</span>
<span class='line-number'>17</span>
<span class='line-number'>18</span>
</pre></td><td class='code'><pre><code class='js'><span class='line'><span class="p">{</span>
</span><span class='line'> <span class="s2">"user"</span><span class="o">:</span> <span class="p">{</span>
</span><span class='line'> <span class="p">...</span>
</span><span class='line'> <span class="s2">"paths"</span><span class="o">:</span> <span class="p">{</span>
</span><span class='line'> <span class="s2">"linux"</span><span class="o">:</span> <span class="p">[],</span>
</span><span class='line'> <span class="s2">"osx"</span><span class="o">:</span> <span class="p">[</span>
</span><span class='line'> <span class="s2">"/Users/jaimiekwon/anaconda/bin/"</span>
</span><span class='line'> <span class="p">],</span>
</span><span class='line'> <span class="s2">"windows"</span><span class="o">:</span> <span class="p">[]</span>
</span><span class='line'> <span class="p">},</span>
</span><span class='line'> <span class="s2">"python_paths"</span><span class="o">:</span> <span class="p">{</span>
</span><span class='line'> <span class="s2">"linux"</span><span class="o">:</span> <span class="p">[],</span>
</span><span class='line'> <span class="s2">"osx"</span><span class="o">:</span> <span class="p">[</span>
</span><span class='line'> <span class="s2">"/Users/jaimiekwon/anaconda/bin/"</span>
</span><span class='line'> <span class="p">],</span>
</span><span class='line'> <span class="s2">"windows"</span><span class="o">:</span> <span class="p">[]</span>
</span><span class='line'> <span class="p">},</span>
</span><span class='line'><span class="p">}</span>
</span></code></pre></td></tr></table></div></figure>
]]></content>
</entry>
<entry>
<title type="html"><![CDATA[Dive Into Jekyll/Octopress + Github Pages]]></title>
<link href="http://Jaimyoung.github.io/blog/2014/09/21/dive-into-jekyll-slash-octopress-plus-github-pages/"/>
<updated>2014-09-21T00:50:40-07:00</updated>
<id>http://Jaimyoung.github.io/blog/2014/09/21/dive-into-jekyll-slash-octopress-plus-github-pages</id>
<content type="html"><![CDATA[<p>I found Google’s Blogger to be tiring in writing workflow.
I looked into a few options:</p>
<ul>
<li>Blogger (working harder!)
<ul>
<li>Pros: Familar google workflow, most of times; analytics out-of-box.</li>
<li>Cons: Slow. Not flexible.</li>
</ul>
</li>
<li>Wordpress
<ul>
<li>Pros: Popular.</li>
<li>Cons: Slow.</li>
</ul>
</li>
<li>Github (md only), or even Gist?
<ul>
<li>Pros: Markdown is already my friend.</li>
<li>Cons: This is not blog.</li>
</ul>
</li>
<li>Github Pages, via Jekyll
<ul>
<li>Pros: Markdown is already my friend; speed; geek credential.</li>
<li>Cons: Initial investment. Too flexible / too many options.</li>
</ul>
</li>
<li>Github Pages, via Jekyll/Octopress
<ul>
<li>Pros: Markdown is already my friend; speed; geek credential; setup is more automatic than Jekyll only option.</li>
<li>Cons: Slightly overweight than Jekyll only.</li>
</ul>
</li>
</ul>
<p>From a few factors, I chose “Github Pages with Jekyll/Octopress” option,
after trying out a bit with Jekyll (no Octopress) option.</p>
<p>So far, so good.</p>
<p>A few to-do items were:</p>
<ol>
<li>Done. ~Turn on Discus Comment~</li>
<li>Done. ~Turn on Google analytics~</li>
<li>Done. <del>Migrating old blogger.</del>
<ol>
<li>To-do. Will follow <a href="http://import.jekyllrb.com/docs/blogger/">http://import.jekyllrb.com/docs/blogger/</a></li>
<li>Actually, followed <a href="https://gist.github.com/baldowl/1578928">this gist</a>.</li>
<li>Still, need to choose what to keep (none?)</li>
</ol>
</li>
<li>Done. <a href="https://github.com/tokkonopapa/octopress-tagcloud">Tag cloud + category list</a></li>
</ol>
<h2>Octopress workflow</h2>
<p>If using <a href="https://github.com/robbyrussell/oh-my-zsh">oh-my-zsh</a>,
<code>rake</code> gives
<code>zsh: no matches found error</code>
all the time. Add this to <code>.zsh</code>:</p>
<pre><code>alias rake='noglob rake'
</code></pre>
<p>Then, the <a href="http://octopress.org/docs/deploying/github/">workflow</a> looks like:</p>
<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
<span class='line-number'>10</span>
<span class='line-number'>11</span>
</pre></td><td class='code'><pre><code class='bash'><span class='line'>rake new_post<span class="o">[</span><span class="s2">"Dive into Jekyll/Octopress + Github Pages"</span><span class="o">]</span>
</span><span class='line'>rake new_page<span class="o">[</span>about<span class="o">]</span>
</span><span class='line'><span class="c"># creates /source/about/index.markdown</span>
</span><span class='line'>
</span><span class='line'>rake generate <span class="c"># Generates posts and pages into the public directory</span>
</span><span class='line'>rake watch <span class="c"># Watches source/ and sass/ for changes and regenerates</span>
</span><span class='line'>rake preview <span class="c"># Watches, and mounts a webserver at http://localhost:4000</span>
</span><span class='line'>
</span><span class='line'><span class="c"># Deploy/publish</span>
</span><span class='line'>rake generate
</span><span class='line'>rake deploy
</span></code></pre></td></tr></table></div></figure>
]]></content>
</entry>
<entry>
<title type="html"><![CDATA[Vertica JDBC in Eclipse/Maven]]></title>
<link href="http://Jaimyoung.github.io/blog/2013/06/10/vertica-jdbc-in-eclipsemaven/"/>
<updated>2013-06-10T18:24:00-07:00</updated>
<id>http://Jaimyoung.github.io/blog/2013/06/10/vertica-jdbc-in-eclipsemaven</id>
<content type="html"><![CDATA[<h4>Problem:</h4>
<p>Want to use Vertica JDBC driver in Eclipse/Maven dependency, but Maven central repository doesn’t have it.</p>
<h4>Solution:</h4>
<ol>
<li>Download vertica JDBC driver jar.</li>
<li><p>At the same directory of that jar, run the following similar to what’s described here. (somehow, running it in an different directory didn’t work. Just created that annoying “*.jar.lastUpdated”)</p>
<pre><code> $ mvn install:install-file -DgroupId=vertica -DartifactId=vertica-jdbc -Dversion=4.0.19 -Dpackaging=jar -Dfile=~/Downloads/vertica/vertica_4.0.19_jdk_5.jar -DgeneratePom=true
</code></pre></li>
<li>In Eclipse, Navigate > Show View > Other > Maven Repository</li>
<li>Open Local Repositories</li>
<li>Rebuild Index</li>
</ol>
<p>Now it shows up in “Add…” dialog in pom.xml edit.</p>
<p>Then have fun:</p>
<ol>
<li><a href="http://chimpler.wordpress.com/2013/05/10/installing-and-comparing-mysqlmariadb-mongodb-vertica-hive-and-impala-part-1/">http://chimpler.wordpress.com/2013/05/10/installing-and-comparing-mysqlmariadb-mongodb-vertica-hive-and-impala-part-1/</a></li>
<li><a href="http://tomgendron.wordpress.com/tag/connecting-java-to-vertica/">http://tomgendron.wordpress.com/tag/connecting-java-to-vertica/</a></li>
</ol>
]]></content>
</entry>
<entry>
<title type="html"><![CDATA[Surviving Date-time, POSIX, Unix Timestamp... In R, Oracle, MySQL, Perl]]></title>
<link href="http://Jaimyoung.github.io/blog/2013/01/12/surviving-date-time-datatype/"/>
<updated>2013-01-12T16:16:00-08:00</updated>
<id>http://Jaimyoung.github.io/blog/2013/01/12/surviving-date-time-datatype</id>
<content type="html"><![CDATA[<p>Timezone / timestamps are easy to mess up.
It helps us in the long run
to have a solid conceptual framework
by reading about, among others:
<a href="http://en.wikipedia.org/wiki/Coordinated_Universal_Time">Timezone / UTC / GMT</a>,
<a href="http://en.wikipedia.org/wiki/Unix_time">Unix epoch / timestamp</a>,
<a href="https://en.wikipedia.org/wiki/ISO_8601">ISO 8601</a>,
and of course an <a href="http://xkcd.com/1179/">XKCD take on this</a>.</p>
<p>Essentially, most tasks are juggling between a few different entities:</p>
<ol>
<li><strong>Unix timestamp</strong>: Good.</li>
<li><strong>String with time zone</strong>: Good. e.g. “2013-06-24T10:21:11Z”</li>
<li><strong>String without time zone</strong>: Bad, bad, bad
<ul>
<li><strong>String with assumed UTC time zone</strong></li>
<li><strong>String with assumed non-UTC time zone</strong></li>
</ul>
</li>
</ol>
<h2>Parsing and formating</h2>
<h3>R</h3>
<p>Remember strptime is STRing to Posix Time class:</p>
<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
<span class='line-number'>10</span>
<span class='line-number'>11</span>
<span class='line-number'>12</span>
<span class='line-number'>13</span>
<span class='line-number'>14</span>
<span class='line-number'>15</span>
</pre></td><td class='code'><pre><code class='r'><span class='line'><span class="c1"># when the string is in "standard" format:</span>
</span><span class='line'><span class="kp">strftime</span><span class="p">(</span><span class="kp">as.POSIXlt</span><span class="p">(</span><span class="s">'2009-12-25 01:23:45'</span><span class="p">),</span>format<span class="o">=</span><span class="s">'%Y-%m-%d %H:%M:%S'</span><span class="p">)</span>
</span><span class='line'><span class="c1"># when the string is in non-standard format:</span>
</span><span class='line'><span class="kp">strftime</span><span class="p">(</span><span class="kp">as.POSIXlt</span><span class="p">(</span><span class="s">'2009-12-25 01:23:45'</span><span class="p">),</span>format<span class="o">=</span><span class="s">'%Y-%m-%d %H:%M:%S'</span><span class="p">)</span>
</span><span class='line'>
</span><span class='line'><span class="c1"># TBD for unix timestamp</span>
</span><span class='line'>
</span><span class='line'><span class="c1"># Date to R date</span>
</span><span class='line'><span class="kp">as.POSIXlt</span><span class="p">(</span><span class="s">'2012-01-02T18:27:44.0000000'</span><span class="p">,</span>
</span><span class='line'><span class="o">+</span> format<span class="o">=</span><span class="s">'%Y-%m-%dT%H:%M:%S.0000000'</span><span class="p">,</span> tz <span class="o">=</span> <span class="s">'GMT'</span><span class="p">)</span>
</span><span class='line'>
</span><span class='line'><span class="c1"># R date to unix timestamp. This is simple.</span>
</span><span class='line'><span class="kp">as.numeric</span><span class="p">(</span> R <span class="kp">date</span><span class="p">)</span>
</span><span class='line'>e.g. <span class="kp">as.numeric</span><span class="p">(</span><span class="kp">as.POSIXlt</span><span class="p">(</span><span class="s">'2012-01-02T18:27:44.0000000'</span><span class="p">,</span>
</span><span class='line'><span class="o">+</span> format<span class="o">=</span><span class="s">'%Y-%m-%dT%H:%M:%S.0000000'</span><span class="p">,</span> tz <span class="o">=</span> <span class="s">'GMT'</span><span class="p">))</span>
</span></code></pre></td></tr></table></div></figure>
<h3>SQL</h3>
<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
<span class='line-number'>10</span>
</pre></td><td class='code'><pre><code class='sql'><span class='line'><span class="c1">-- Oracle variant</span>
</span><span class='line'><span class="k">select</span> <span class="n">to_char</span><span class="p">(</span> <span class="n">to_date</span><span class="p">(</span><span class="s1">'yyyy-mm-dd hh24:mi:ss'</span><span class="p">,</span> <span class="s1">'2009-12-25 01:23:45'</span><span class="p">),</span> <span class="s1">'mm/dd/yyyy hh24:mi:ss'</span><span class="p">)</span>
</span><span class='line'><span class="k">from</span> <span class="n">dual</span><span class="p">;</span>
</span><span class='line'>
</span><span class='line'><span class="c1">-- MySQL variant</span>
</span><span class='line'><span class="k">SELECT</span> <span class="n">DATE_FORMAT</span><span class="p">(</span><span class="n">xxx</span><span class="p">,</span><span class="s1">'%Y-%m'</span><span class="p">);</span>
</span><span class='line'>
</span><span class='line'>
</span><span class='line'><span class="c1">-- PostgreSQL variant</span>
</span><span class='line'><span class="c1">-- TBD</span>
</span></code></pre></td></tr></table></div></figure>
<h3>Perl</h3>
<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
</pre></td><td class='code'><pre><code class='perl'><span class='line'><span class="k">use</span> <span class="n">POSIX</span><span class="p">;</span>
</span><span class='line'><span class="k">my</span> <span class="nv">$date</span> <span class="o">=</span> <span class="nn">POSIX::</span><span class="n">strftime</span><span class="p">(</span><span class="s">'%Y-%m-%d'</span><span class="p">,</span> <span class="c1"># '%Y-%m-%d %H:00:00',</span>
</span><span class='line'> <span class="nb">gmtime</span><span class="p">(</span><span class="nv">$timestamp</span><span class="p">));</span>
</span></code></pre></td></tr></table></div></figure>
<h3>Java</h3>
<p>Save yourself trouble. Use <a href="http://www.joda.org/joda-time/">Joda Time</a></p>
<h2>Iterate over days and months</h2>
<p>Another imortant</p>
<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class='bash'><span class='line'><span class="c"># TBA</span>
</span></code></pre></td></tr></table></div></figure>
<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class='python'><span class='line'><span class="c"># TBA</span>
</span></code></pre></td></tr></table></div></figure>
<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class='r'><span class='line'><span class="c1"># TBA</span>
</span></code></pre></td></tr></table></div></figure>
<p>`</p>
]]></content>
</entry>
<entry>
<title type="html"><![CDATA[Tech Books That Influenced Me]]></title>
<link href="http://Jaimyoung.github.io/blog/2012/10/29/tech-books-that-influenced-me/"/>
<updated>2012-10-29T12:16:00-07:00</updated>
<id>http://Jaimyoung.github.io/blog/2012/10/29/tech-books-that-influenced-me</id>
<content type="html"><![CDATA[<ol>
<li>The Elements of Statistical Learning (2008) by Hastie, Tibshirani, Friedman</li>
<li>Perl Best Practices (2005) by Damian Conway</li>
<li>Thinking, Fast and Slow (2013) by Daniel Kahneman</li>
<li>Freakonomics (2006) by Levitt and Dubner</li>
<li>Nudge: Improving Decisions About Health, Wealth, and Happiness (2009) by Thaler and Sunstein</li>
<li>“The Black Swan: The Impact of the Highly Improbable Fragility” by Nassim Nicholas Taleb (2008)</li>
<li>Cracking the Coding Interview: 150 Programming Questions and Solutions</li>
</ol>
]]></content>
</entry>
<entry>
<title type="html"><![CDATA[Surviving SVN]]></title>
<link href="http://Jaimyoung.github.io/blog/2012/10/22/surviving-svn/"/>
<updated>2012-10-22T16:01:00-07:00</updated>
<id>http://Jaimyoung.github.io/blog/2012/10/22/surviving-svn</id>
<content type="html"><![CDATA[<p>Philosophy: tree organization and life cycle</p>
<p>Below is the typical directory structure. Numbers here mean the typical execution order in the lifecycle of the product. See the section in the official doc or another “ practical take”.</p>
<pre><code>project-name
trunk : (1) the latest and greatest. Keep working on this all the while (2)-(9) are happening.
branches
1.0 : (2) copied from trunk when the 1.0 release is planned (3) test (4) release (6) keep on maintain for bug fixes [merged to/from the trunk] (7) released when enough bug fixes are accumulated ...
2.0: (10) copied from trunk whn the 2.0 release is planned .. repeat.
tag
1.0.0 (5) tagged when released
1.0.1 (8) tagged at the time of the bug fix release
</code></pre>
<p>Minimal commands</p>
<pre><code># start developing
svn checkout svn+ssh://username@servername/repos/project-name/trunk
# daily cycle
svn update
svn commit -m '
</code></pre>
<p>Slightly advanced commands</p>
<pre><code># weekly cycle (if working on separate branch)
svn merge ^/trunk
# creating branch / tag
svn copy svn+ssh://username@servername/repos/project-name/trunk \
svn+ssh://username@servername/repos/project-name/branches/1.0
# comparing two branches
# (many modern editors syntax highlight *.diff files)
svn diff ^/trunk ^/branches/1.0 > trunk-vs-1.0.diff
</code></pre>
<p>Defensive commands</p>
<pre><code># bailing out
# svn revert xxx or more transparently:
rm xxx; svn update xxx
# rolling back to a previous revision
svn merge -r HEAD:23340 xxx
svn commit -m 'Rolled back to r 23340'
</code></pre>
]]></content>
</entry>
<entry>
<title type="html"><![CDATA[Surviving Sqlplus]]></title>
<link href="http://Jaimyoung.github.io/blog/2012/10/19/surviving-sqlplus/"/>
<updated>2012-10-19T03:20:00-07:00</updated>
<id>http://Jaimyoung.github.io/blog/2012/10/19/surviving-sqlplus</id>
<content type="html"><![CDATA[<p>Starting</p>
<pre><code>> sqlplus username/passwd@dbname
SQL> quit
> sqlplus username/passwd@dbname / @filename
</code></pre>
<p>Editing script / buffer</p>
<pre><code>SQL> define_editor='vi'
-- or emacs if you have one
SQL> edit
-- edit the buffer
SQL> run
-- run the buffer
SQL> save filename
-- saves the buffer to a file (*.SQL); appends a slash at the end (which is important)
SQL> edit filename
-- create a file
SQL> get filename
-- get external file into the buffer
SQL> start filename
SQL> @filename
-- batch run of the file
SQL> spool filename
SQL> spool off
-- start / stop spooling
SQL> !os_command
-- runs shell command
SQL> /
-- run the command and store it in the SQL buffer.
</code></pre>
]]></content>
</entry>
<entry>
<title type="html"><![CDATA[Principal Components Analysis for Dimensionality Reduction in R]]></title>
<link href="http://Jaimyoung.github.io/blog/2012/10/16/principal-components-analysis-for/"/>
<updated>2012-10-16T12:57:00-07:00</updated>
<id>http://Jaimyoung.github.io/blog/2012/10/16/principal-components-analysis-for</id>
<content type="html"><![CDATA[<pre><code>PCA in R
PCA is well known tool in dimensionality reduction. Many nice articles on the subject of "principal component analysis for dimension reduction"
Typically combined with Fisher linear discriminant analysis in classification tasks.
In R, there's prcomp and princomp implementation. See this tutorial for some theory.
Question: for cross-validation task where PCA will be used for pre-processing explanatory variables, should PCA be applied to the training data only or to the whole data?
Random Forest in R
Always helps to read about the original idea.
Implementation is painless. Just use randomForest package in R. This guide is very nice, touching on key points.
Run it on the data. Don't forget to cross-validate.
Accuracy evaluation with ROC curve.
Evaluate importance of variables.
Question: Would PCA help random forest?
There's a choice of exactly how. Suppose X is the raw data (with many columns k) and X' be the PCA of that for top k' (<< k); do we use X? X'? [X; X']? Why?
Why would PCA help random forest for any of the choices above?
If not, why and how else can one improve random forest?
See also...
Latent semantic analysis (LSA): yet another SVD-driven data reduction technique applied to term-document data. (Was this patented??)
Classical classification methods: usual suspects including:
logistic regression (glm in R with family='binomial');
tree method (rpart in R)
neural net
</code></pre>
<p>Read this first for any data mining exercise. Always an awesome refresher. I have a copy of the 1st edition and… was shocked to see that doesn’t cover random forest! (2nd edition has that. Chapter 15)</p>
]]></content>
</entry>
<entry>
<title type="html"><![CDATA[영어 콤플렉스]]></title>
<link href="http://Jaimyoung.github.io/blog/2012/10/12/english-complex-korean/"/>
<updated>2012-10-12T16:32:00-07:00</updated>
<id>http://Jaimyoung.github.io/blog/2012/10/12/english-complex-korean</id>
<content type="html"><![CDATA[<p>영어가 공용어인 국제학회에서 자주 느끼게 되는 것은 동양사람들이 겪는 영어의 어려움이다. 외국인들 중에서도 유럽사람들은 보통 편안하게 영어를 하는 편인데 한-중-일 삼개국은 영어에서 큰 어려움을 겪는 경우가 많다.</p>
<p>일본 사람들은 히라가나의 한계상 모음의 수가 적으므로 어려움이 더 크다. “마구도나루도”, “도라이바”, “가류” :) 등으로 대표되는 음소의 한계가 문제다. 한국은 그 정도는 아니지만 경험상 다음 발음들 때문에 어려움을 겪는다:</p>
<ol>
<li>f / p 구분. 사실 비교적 해결이 쉬운 문제이다.</li>
<li>r / l 구분. 역설적인 것은 혀를 굴리는 r 발음보다 엘 (l) 발음이 문제라는 것. 나도 wool socks를 몇번 달라고 반복해도 실패한 아픈 경험이 있다. Gilroy란 도시를 map app에서 아무리 voice recognition을 시켜 봐도 안되는것이 현실이다.</li>
<li>a / e 구분. 이것은 사실 잘 들리지도 않는다.</li>
<li>장-단 모음. 그러므로 beach와 sheet를 발음할 때는 extra로 신경이 쓰인다는 것.</li>
</ol>
<p>또한 흥미 있는 것은 스스로의 부족한 영어실력에 대한 반응이다. 유럽인들 중에서도 상당히 망가진 영어를 구사하는 발표자들이 있는데 그들의 태도는 “그럼 어때”에 가까운 경우가 많다. 자기 말이 아니니 못하는게 당연하다는… 이에 반해 동양삼개국, 특히 한국과 일본 분들의 경우는 좀더 영어의 어려움을 아프게, 개인적(personal)으로 받아들이는 경향이 있다. 물론 체면을 중시하고 무언가를 잘 못하는 것을 개인적 실패로 받아들이는 문화의 교육 탓이겠지.</p>
<p>어느 것이 옳은 태도인가? 자학하는 것보다는 할만큼 하고 안되면 그만인 태도가 도움이 된다. 실제로 영어하는 사람들은 non native speaker가 영어못하는 것 충분히 이해하고 가려 듣는다. 역설적으로, 그런 편안한 마음을 가질때 발표도 잘된다는 것. 영어는 자신감이다.</p>
]]></content>
</entry>
</feed>