This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Getting and Cleaning Data Project John Hopkins Coursera | |
# Author: Michael Galarnyk | |
# 1. Merges the training and the test sets to create one data set. | |
# 2. Extracts only the measurements on the mean and standard deviation for each measurement. | |
# 3. Uses descriptive activity names to name the activities in the data set | |
# 4. Appropriately labels the data set with descriptive variable names. | |
# 5. From the data set in step 4, creates a second, independent tidy data set with the average of each variable for each activity and each subject. | |
# Load Packages and get the Data |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Linear Regression predicts linear relationship between two variables | |
# Set path to Desktop | |
setwd("~/Desktop") | |
download.file(url = 'https://raw.githubusercontent.com/mGalarnyk/Python_Tutorials/master/Python_Basics/Linear_Regression/linear.csv' | |
, destfile = 'linear.csv') | |
rawData=read.csv("linear.csv", header=T) | |
# Show first n entries of data.frame, notice NA values |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#install.packages("twitteR") | |
library(twitteR) | |
# Change the next four lines based on your own consumer_key, consume_secret, access_token, and access_secret. | |
consumer_key <- "OQMbUsBfWQ1mVUGASpSArbG33" | |
consumer_secret <- "GQ5kc0BlwJZE2FYyvv8cxn845z32ES6HsID87cawkQ075jwyIy" | |
access_token <- "4338966852-lBmLvEg9mADHIdjK2hT4W5mtHmI9jRKxcV4PTrB" | |
access_secret <- "AwKRZw9AvTMvMrb2jouX5JHTjDASI3zeceVsemgQa1SSq" | |
setup_twitter_oauth(consumer_key, consumer_secret, access_token, access_secret) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#install.packages("jsonlite") | |
library(jsonlite) | |
#install.packages("httpuv") | |
library(httpuv) | |
#install.packages("httr") | |
library(httr) | |
# Can be github, linkedin etc depending on application | |
oauth_endpoints("github") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import pandas as pd | |
from sklearn.linear_model import LinearRegression | |
import matplotlib.pyplot as plt | |
# Read in csv file | |
# File: https://github.com/mGalarnyk/Python_Tutorials/blob/master/Python_Basics/Linear_Regression/linear.csv | |
raw_data = pd.read_csv("linear.csv") | |
# Removes rows with NaN in them |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1404/x86_64/ | |
wget http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1404/x86_64/cuda-repo-ubuntu1404_7.5-18_amd64.deb | |
sudo dpkg -i cuda-repo-ubuntu1404_7.5-18_amd64.deb | |
rm cuda-repo-ubuntu1404_7.5-18_amd64.deb | |
echo 'export CUDA_HOME=/usr/local/cuda | |
export CUDA_ROOT=/usr/local/cuda | |
export PATH=$PATH:$CUDA_ROOT/bin:$HOME/bin | |
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CUDA_ROOT/lib64 | |
' >> ~/.bashrc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Install R + RStudio on Ubuntu 14.04 | |
sudo apt-key adv –keyserver keyserver.ubuntu.com –recv-keys E084DAB9 | |
# Ubuntu 12.04: precise | |
# Ubuntu 14.04: trusty | |
# Ubuntu 16.04: xenial | |
# Basic format of next line deb https://<my.favorite.cran.mirror>/bin/linux/ubuntu <enter your ubuntu version>/ | |
sudo add-apt-repository 'deb https://ftp.ussg.iu.edu/CRAN/bin/linux/ubuntu trusty/' | |
sudo apt-get update |