Data and Code
/
Recent content on Data and CodeHugo -- gohugo.ioen-usSat, 28 Sep 2019 00:00:00 +0000Learn Haskell 3: Algebraic Data Types
/2019/09/28/learn-haskell-3/
Sat, 28 Sep 2019 00:00:00 +0000/2019/09/28/learn-haskell-3/A recent revelation I had is:
All I’m doing when I program is nothing but doing algebra - algebra on numbers and algebra on types.
Algebra on numbers are prevelant in functional programming, when we write a function, we mostly either do some algebra with the arguments, or call some other functions to do algebra for us. Afterall, functional programs are kind of like “executable mathamatics”.
What do I mean by “algebra on types”?Learn Haskell 1: Hello world
/2019/09/08/learn-haskell-1/
Sun, 08 Sep 2019 00:00:00 +0000/2019/09/08/learn-haskell-1/--- title: "Learn Haskell 1: Hello world" author: '' date: '2019-09-08' slug: learn-haskell-1 categories: - functional programming - programming tags: - Functional Programming --- Learn Haskell by going through Bartosz Milewski’s youtube lectures.
Lecture 1 In Haskell, you don’t need brackets for function application, so here’s goes the classic hello-world example:
putStrLn "Hello, world!" ## Hello, world! This doesn’t look any different to other programming languages, but the mind blowing thing is, putStrLn is actually not causing any side effect.Learn Haskell 2: Function and Data Type
/2019/09/08/learn-haskell-2/
Sun, 08 Sep 2019 00:00:00 +0000/2019/09/08/learn-haskell-2/Part 1: function, currying, pattern matching and function composition It makes sense that if some pattern/idea is used a lot, then it should be denoted with minial syntax. It follows that Haskell, famous for being functional, doesn’t even have a keyword for defining functions. To define a function, start with function name (add for example), followed by argument list separated by spaces, followed by = and then the function body:Encode boolean values and operations with pure functions
/2018/09/25/encode-boolean-and-logical-operations-with-pure-functions/
Tue, 25 Sep 2018 00:00:00 +0000/2018/09/25/encode-boolean-and-logical-operations-with-pure-functions/Computerphile has a really good video that covers the fundamental ideas of lambda calculus, which is the basis of most functional programming languages. One of the example it went throught is encoding boolean values (true/false) using pure functions - it really bended my mind.
The fundamental idea of a boolean value is making a choice. So, the encoding of boolean values encode that idea! The true value can be encoded as a function that takes two inputs, x and y, and return the first input, x, that is, it chooses the first input.R: from on.exit() to quasiquotation
/2018/03/26/r-on-exit-and-sys-on-exit/
Mon, 26 Mar 2018 00:00:00 +0000/2018/03/26/r-on-exit-and-sys-on-exit/Part 1
Often one needs to write functions that not only perform computation on its own, but also interact with the world outside of the function execution environment, for example, writing to a file, saving plots or changing working directory. Computer scientists called these operations side effects, in the sense that these functions change some aspects of the global state of the software. To be more precise, writing to a file requires a file connection to be established, saving plots requires opening a graphical device and changing working directories affects how to find things in the computer file system.Deep Learning in R 1: logistic regression with a neural netwrok mindset from scratch in R
/2018/02/10/deep-learning-neural-network-from-scratch-in-r/
Sat, 10 Feb 2018 00:00:00 +0000/2018/02/10/deep-learning-neural-network-from-scratch-in-r/Intro
Data Preparation
Logistic Regression
Forward Propagation
Backward Propagation
Implementation
Train Model
Understand the Result
Summary
Intro
With online courses, I feel I am usually too rushed to complete them for at least two reasons:
Save money because I pay a monthly fee.
Eager to get a certificate so I can overestimate myself.
So this time I think perhaps I should pause and let it precipitate.Statistical Learning: Cross Validation wrong and right way
/2018/01/27/statistical-learning-cross-validation/
Sat, 27 Jan 2018 00:00:00 +0000/2018/01/27/statistical-learning-cross-validation/Intro
The Wrong Way
The Right Way
summary
Intro
Cross validation is one of the most popular methods for estimating test error and selecting tuning parameters, however, one can easily be mislead/confused by it without realising it.
In chapter 5 of An Introduction to Statistical learning, the authors stress that if a dataset has a lot of features and relatively fewer observations, the variable selection process should also be cross validated.Statistical Learning: a bootstrap sample contains two thirds of original data points?
/2018/01/21/statistical-learning-how-to-prove-a-bootstrap-sample-is-expected-to-contain-63-2-two-thirds-of-original-data-points/
Sun, 21 Jan 2018 00:00:00 +0000/2018/01/21/statistical-learning-how-to-prove-a-bootstrap-sample-is-expected-to-contain-63-2-two-thirds-of-original-data-points/Intro
Recently, I am studying The Elements of Statistical Learning out of my own interest. An interesting topic they covered briefly on their online videos is bootstrap. Bootstrap, in the simplest terms, is the process of generating samples from sample. Say you collected a sample of n data points, a bootstrap sample is generated by sampling n data points from the original sample you collected with replacement. (So Given a sample size of n, you are able to generate \(n^n\) bootstrap samples.R: Setting options
/2018/01/07/setting-options-in-r/
Sun, 07 Jan 2018 00:00:00 +0000/2018/01/07/setting-options-in-r/When developing a package or a set of functions, you often needs a lot of options. Often, you would want to set some sensible defaults for each option whilst giving users the flexibility to customize and extend. Take ggplot2 for example, if you ever used it, you know the background of the plots is, by default, grey, though You have the flexibility to change it.
While there are many ways to set options, I haven’t found a summary of pros and cons of different approaches and I certainly don’t know what best practices are.About
/about/
Mon, 01 Jan 2018 00:00:00 +0000/about/I am a programming hobbyist, data science/engineering enthusiast. Inspired by Yihui, I realize I should try to write about what I’m learning - it’s probably an effective way to turn passive learning into active/creative thinking and consolidate my thoughts. I also hope my posts can help others as well as helping me. And I wish to connect with people who share similar passions.
I currently work as a Data Engineer at WooliesX, Sydney.My first blog post
/2018/01/01/my-first-blog-post/
Mon, 01 Jan 2018 00:00:00 +0000/2018/01/01/my-first-blog-post/If you’re not prepared to be wrong, you’ll never come up with anything original.
— Ken Robinson in a Ted Talk
Starting this blog as new year resolution!
While building this blogdown website is made so easy with blogdown package, I did have a difficult time setting up ssh for use. Perhaps I should learn the ssh and do it as my second post? I also want to talk about R, vim, building websites as I learn it.