This file contains hidden or 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
# Tidyverse-R-code from 2020 | |
# (this code is also artificially slowed down, with purrr::slowly(), | |
# to avoid HTTP 429 errors (too many requests) | |
library(tidyverse) | |
library(httr) | |
library(xml2) | |
library(lubridate) | |
theme_set(theme_bw()) |
This file contains hidden or 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
package demo; | |
// see http://stackoverflow.com/questions/38464468/weka-linear-regression-doesnt-load/ | |
import weka.classifiers.functions.LinearRegression; | |
import weka.core.Attribute; | |
import weka.core.DenseInstance; | |
import weka.core.FastVector; | |
import weka.core.Instance; | |
import weka.core.Instances; |
This file contains hidden or 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
# https://gist.github.com/knbknb/1d17caecd9b800d5148a30d537013668 | |
# Thu Aug 16 11:24:05 2018 ------------------------------ | |
# Rosenblatt's perceptron | |
# this is from 2013, based on a forum post by a chinese user (don't remember his name) | |
# "learning from data" course, Prof Yaser Abu-Mostafa | |
# http://work.caltech.edu/telecourse.html | |
# create a xy-plot and an animated gif visualizing the training process | |
data(iris) |
This file contains hidden or 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
# To run this code, first edit config.py with your configuration (Auth data), then install necessary modules, then: | |
# | |
# Call | |
# | |
# mkdir data | |
# python twitter_stream_download.py -q apple -d data | |
# | |
# | |
# It will produce the list of tweets for the query "apple" | |
# in the file data/stream_apple.json |
This file contains hidden or 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
date | close | |
---|---|---|
2014-02-07 | 361.08 | |
2014-02-06 | 354.59 | |
2014-02-05 | 346.45 | |
2014-02-04 | 347.95 | |
2014-02-03 | 346.15 | |
2014-01-31 | 358.69 | |
2014-01-30 | 403.01 | |
2014-01-29 | 384.2 | |
2014-01-28 | 394.43 |
This file contains hidden or 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
# from the datacamp course | |
# 'Exploratory Data Analysis in R: Case Study' | |
# by David Robinson | |
# | |
# this gist demonstrates an idiom that I tend to forget the details of | |
# group_by / nest / model /unnest | |
# | |
# Load purrr, tidyr, and broom | |
library(purrr) | |
library(tidyr) |
This file contains hidden or 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
#!/bin/sh | |
# https://stackoverflow.com/questions/48659631/github-issues-api-and-jq-filter-and-grep | |
# get github issues | |
GITHUB_PAT=5b01b116.... | |
#user=Leaflet | |
#repo=Leaflet | |
user=stedolan | |
repo=jq | |
url=https://$GITHUB_PAT:[email protected]/repos/$user/$repo/issues | |
echo curl -k -I $url?state=all\\\&per_page=10 |
This file contains hidden or 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
# see also: | |
# https://s3.amazonaws.com/assets.datacamp.com/blog_assets/xts_Cheat_Sheet_R.pdf | |
# Open csv file using read.zoo | |
my_tsdata <- read.zoo("my_tsdata.csv", sep = ",", FUN = as.Date, header = TRUE, index.column = 1) | |
my_tsdata <- as.xts(my_tsdata) | |
This file contains hidden or 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
home.team | score | away.team | round | score_home | score_visiting | home.wins | away.wins | |
---|---|---|---|---|---|---|---|---|
Athletic | 4-2 | Valladolid | 20 | 4 | 2 | 3 | 0 | |
Atletico | 1-1 | Sevilla | 20 | 1 | 1 | 1 | 1 | |
Betis | 0-5 | R. Madrid | 20 | 0 | 5 | 0 | 3 | |
Espanyol | 1-0 | Celta | 20 | 1 | 0 | 3 | 0 | |
Villarreal | 2-0 | Almeria | 20 | 2 | 0 | 3 | 0 | |
Malaga | 0-0 | Valencia | 20 | 0 | 0 | 1 | 1 | |
Elche | 2-0 | Rayo | 20 | 2 | 0 | 3 | 0 | |
Getafe | 2-2 | R. Sociedad | 20 | 2 | 2 | 1 | 1 | |
Levante | 1-1 | Barcelona | 20 | 1 | 1 | 1 | 1 |
This file contains hidden or 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
#Sys.setenv(JAVA_OPTIONS = "-Xmx8g -Xms1G -XX:+UseConcMarkSweepGC -XX:-UseGCOverheadLimit") | |
library(tidyverse) | |
library(coreNLP) | |
# from: https://stackoverflow.com/questions/48455079/extract-city-names-from-large-text-with-r | |
# using COreNLP to extract tokens | |
# knb 20180422 | |
outputloc <- "/opt/smallapps/corenlp/" | |
nlpver <- 2018 | |
if(nlpver != 2018){ |
OlderNewer