Skip to content

Instantly share code, notes, and snippets.

View sureshgorakala's full-sized avatar

Suresh Gorakala sureshgorakala

  • www.dataperspective.info
View GitHub Profile
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@sureshgorakala
sureshgorakala / search_engine_svd.r
Created December 11, 2017 07:25
Search engine using SVD in R
#load required pacakges
if(!require("readtext"))
install.packages("readtext")
library(readtext)
if(!require("tm"))
install.packages("tm")
library(tm)
if(!require("stringr"))
@sureshgorakala
sureshgorakala / getting started with RStudio.ipynb
Created December 2, 2017 09:15
getting started with RStudio
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@sureshgorakala
sureshgorakala / information_retreival_part1.r
Last active October 24, 2017 05:03
The code shows how to build basic search engine using vector space model in R
#load required pacakges
if(!require("readtext"))
install.packages("readtext")
library(readtext)
if(!require("tm"))
install.packages("tm")
library(tm)
if(!require("stringr"))
import nltk
#reading text into python
path = "~/textCourpus.txt"
f = open(path,'r')
lines = [line.replace('\n','') for line in f.readlines()]
#lines2 = [line.replace('\n','') for line in f.readlines()]
type(lines)
len(lines)
@sureshgorakala
sureshgorakala / PCA using R
Created February 27, 2016 08:16
Data Science using R
library(pca)
data("crimtab") #load data
head(crimtab) #show sample data
dim(crimtab) #check dimensions
str(crimtab) #show structure of the data
sum(crimtab)
colnames(crimtab)
apply(crimtab,2,var) #check the variance accross the variables
pca =prcomp(crimtab) #applying principal component analysis on crimtab data
par(mar = rep(2, 4)) #plot to show variable importance
@sureshgorakala
sureshgorakala / Codefile
Created December 10, 2015 00:29
chi-square of Independence
import pandas
import numpy
import scipy.stats
import seaborn
import matplotlib.pyplot as plt
# any additional libraries would be imported here
data = pandas.read_csv('C:\\Suresh\\Blog Posts\\datasets\\nesarc_pds1134\\SPLITDATA\\CourseData.csv', low_memory=False)
@sureshgorakala
sureshgorakala / blogpost.r
Last active December 5, 2015 13:57
BloggerGist
#mean of the rows
apply(m, 1, mean)
# mean of the columns
apply(m, 2, mean)
# divide all values by 2
apply(m, 1:2, function(x) x/2)
@sureshgorakala
sureshgorakala / include.html
Last active August 29, 2015 14:01
HTML test
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<h1>HTML UI</h1>
<table>
library(twitteR)
library(tm)
library(stringr)
library(wordcloud)
#fetch data
load("D:/Suresh R&D/Emirates Airlines SNA/twitteR_credentials")
registerTwitterOAuth(twitCred)
tweets = searchTwitter("@emirates", lang="en",cainfo="D:/Suresh R&D/Emirates Airlines SNA/cacert.pem")
#remove retweets