Skip to content

Instantly share code, notes, and snippets.

View abmathewks's full-sized avatar

Abraham Mathew abmathewks

View GitHub Profile
@supriya-gdptl
supriya-gdptl / UninstallTensorFlow.txt
Created December 5, 2017 14:07
Steps to uninstall tensorflow
pip show tensorflow
pip uninstall tensorflow
# Tensorflow 1.4 works only with Python 3.5
# to install downgrade Python 3.6 to Python 3.5 in Anaconda
conda install python=3.5
# now install tensorflow 1.4
sudo apt-get install python3-pip python3-dev
pip install tensorflow
@kmclaugh
kmclaugh / Keras_Linear_Model.py
Last active February 4, 2021 15:13
Keras Model for a Simple Linear Function (ie Keras modeling a linear regression)
import pandas as pd
import numpy as np
import seaborn as sns
from keras.layers import Dense
from keras.models import Model, Sequential
from keras import initializers
## ---------- Create our linear dataset ---------------
## Set the mean, standard deviation, and size of the dataset, respectively
@jonathancallahan
jonathancallahan / pylogger.R
Created March 15, 2017 23:07
R script that wraps futile.logger to emulate python style logging for six levels: TRACE, DEBUG, INFO, WARN, ERROR, FATAL.
#' @name logger.setup
#' @export
#' @title Set Up Python-Style Logging
#' @param traceLog file name or full path where \code{logger.trace()} messages will be sent
#' @param debugLog file name or full path where \code{logger.debug()} messages will be sent
#' @param infoLog file name or full path where \code{logger.info()} messages will be sent
#' @param warnLog file name or full path where \code{logger.warn()} messages will be sent
#' @param errorLog file name or full path where \code{logger.error()} messages will be sent
#' @param fatalLog file name or full path where \code{logger.fatal()} messages will be sent
#' @return No return value.
@kdkorthauer
kdkorthauer / RstudioServerSetup.sh
Created October 7, 2016 15:04
Bash script to set up R, install a few R packages, and get Rstudio Server running on ubuntu.
sudo sh -c 'echo "deb http://cran.rstudio.com/bin/linux/ubuntu trusty/" >> /etc/apt/sources.list'
gpg --keyserver keyserver.ubuntu.com --recv-key E084DAB9
gpg -a --export E084DAB9 | sudo apt-key add -
sudo apt-get update
sudo apt-get -y install r-base libapparmor1 libcurl4-gnutls-dev libxml2-dev libssl-dev gdebi-core
sudo apt-get install libcairo2-dev
sudo apt-get install libxt-dev
sudo apt-get install git-core
sudo /bin/dd if=/dev/zero of=/var/swap.1 bs=1M count=1024
@dgrapov
dgrapov / SOM example.R
Last active March 11, 2023 11:21
Self-organizing map (SOM) example in R
#SOM example using wines data set
library(kohonen)
data(wines)
set.seed(7)
#create SOM grid
sommap <- som(scale(wines), grid = somgrid(2, 2, "hexagonal"))
## use hierarchical clustering to cluster the codebook vectors
groups<-3
@cheuerde
cheuerde / inra_glmm.r
Last active October 22, 2017 04:22
Animal Model in INLA (R-INLA) - GLMM
# Claas Heuer, November 2015
# install the package
install.packages("INLA", repos="http://www.math.ntnu.no/inla/R/stable")
# run a test on BGLR data
library(INLA)
library(BGLR)
data(wheat)
@markglenfletcher
markglenfletcher / cheat.txt
Created September 30, 2015 20:02
SQL cheat sheet
SQL
Statements always end with a semi-colon ;
Statement breakdown:
CREATE TABLE table_name (
column_1 data_type,
column_1 data_type
);
## Load libraries
library(XML)
library(dplyr)
library(RCurl)
## Get the results for a specific term
scrape_term = function(search_term,npages){
base_url = "http://scholar.google.com/scholar?"
search_string = paste0("q=",paste0(strsplit(search_term," ")[[1]],collapse="+"))
dat = data.frame(NA,nrow=10*npages,ncol=3)
@bsweger
bsweger / useful_pandas_snippets.md
Last active April 19, 2024 18:04
Useful Pandas Snippets

Useful Pandas Snippets

A personal diary of DataFrame munging over the years.

Data Types and Conversion

Convert Series datatype to numeric (will error if column has non-numeric values)
(h/t @makmanalp)