Imran Kocabiyik Personal Website
/
Recent content on Imran Kocabiyik Personal WebsiteHugo -- gohugo.ioen-usSat, 20 Oct 2018 00:00:00 +0000Photo & Video
/photo-video/
Sat, 20 Oct 2018 00:00:00 +0000/photo-video/Boomerang with Drone Sunrise in Nemrut Mountain We are on Nemrut Mountain.
Playing with Light Elif took this photo in Potsdam, Berlin. In Golden Hour.
Logistic Regression - Titanic Example
/logistic-regression---titanic-example/
Sat, 01 Sep 2018 00:00:00 +0000/logistic-regression---titanic-example/This is the competition on Kaggle: https://www.kaggle.com/c/titanic
Import Data: library(tidyverse) df_train <- read_csv('data/train.csv') df_test <- read_csv('data/test.csv') 1. Gender Submission Sex is the most important feature variable. Submit it by setting Survival to 1 if Sex == Female and 0 otherwise.
# gender submission df_test %>% mutate(Survived = if_else(Sex == 'Female', true = 1L, false = 0L)) %>% select(PassengerId, Survived) %>% write.csv('gender_submission_test.csv', row.names = FALSE) kaggle competitions submit -c titanic -f gender_submission_test.About
/about/
Sun, 13 May 2018 00:00:00 +0000/about/Hello! This my personal blog where I mostly write about rstatsKarakalem ve Resim [Charcoal and Painting]
/art/
Sun, 13 May 2018 00:00:00 +0000/art/Yaşar Kemal Alınca’da Günbatımı (Sunset in Alınca Village) Likya yolu üzerinde Alınca Köyünde gün batarken. Elif ve Ben.
Sunset in Alınca, a village on Lycian Way. Elif and me.
Cemal Süreya Askerde iken çizdiğim bir resim. Sadece tek kalemim vardı. Askerden döndükten sonra çeşitli karakalemler ve kömür ile yeniden üzerinden geçtim. Kömür ile üzerinden geçtikten sonra resim bir boyut kazandı.
I drew this when I was in compulsory military service.Flight Map with ggplot2
/flight-map-with-ggplot2/
Wed, 09 May 2018 00:00:00 +0000/flight-map-with-ggplot2/Flight Map with ggplot2 A flight map with ggplot2:
We need:
- A cartesian space. x \(\mapsto\) lat, y \(\mapsto\) lon
- Line segments to represent routes
- Polygons to represent to country borders
1. Routes Create some routes:
# create routes library(dplyr) routes <- tribble( ~origin_airport, ~dest_airport, "IST", "TXL", "TXL", "TSF", "TXL", "ZRH", "TXL", "CPH", "TXL", "DLM", "TXL", "ADA", "TXL", "BOJ", "TXL", "TFS", "TXL", "BOS", "TXL", "FAE", "TXL", "CUZ" ) 2.Visualize Gradient Descent with ggplot2
/visualize-gradient-descent-with-ggplot2/
Wed, 09 May 2018 00:00:00 +0000/visualize-gradient-descent-with-ggplot2/Gradient Descent Visualization with ggplot2 Gradient Descent is a useful method for solving optimization problems. In this post, I would like to visualize how it works.
The problem I would like to focus is linear regression and I will use mtcars dataset.
1. Outline The hypothesis: \(h_\theta(x) = \theta_0+\theta_1 x\). This is a linear model.
To fit the model, we need to define a cost function: \(J(\theta_0, \theta_1) = \frac{1}{2m}\sum\limits_1^m(h_\theta(x^i)-y^i)^2\)Linear Regression with Gradient Descent
/linear-regression-with-gradient-descent/
Tue, 08 May 2018 00:00:00 +0000/linear-regression-with-gradient-descent/Linear Regression with Gradient Descent I will try to solve a linear regression problem with Gradient Descent optimization algorithm.
1. Notations and Definitions Assume the training set below: (a tibble in R)
library(dplyr) as_tibble(cars) ## # A tibble: 50 x 2 ## speed dist ## <dbl> <dbl> ## 1 4.00 2.00 ## 2 4.00 10.0 ## 3 7.00 4.00 ## 4 7.00 22.0 ## 5 8.00 16.0 ## 6 9.00 10.Logistic Regression with Gradient Descent
/logistic-regression-with-gradient-descent/
Tue, 08 May 2018 00:00:00 +0000/logistic-regression-with-gradient-descent/1. Classification Classification is like a regression problem but the output we would like predict is discrete valued.
Here we will focus on binary classification problem.
\(y\in\{0,1\}\)
1.1 Hypothesis Representation The predictions: \(g(\theta^Tx)\)
Sigmoid function (or Logistic function): \(g(z) = \frac{1}{1+e^{-z}}\)
\(h_\theta(x) = \theta_0x_1 +\theta_1x_2+\theta_2x_3+... = \theta^Tx\)
1.1. 1 Sigmoid Function Visualization library(ggplot2) library(dplyr) sigmoid <- function(x) {1/(1+exp(1)^(-x))} data_frame(x = c(-8, 8), y = c(0, 1)) %>% ggplot(aes(x = x, y = y))+ stat_function(fun = sigmoid) \(h_\theta(x) = 0.