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 | |
np.random.seed(0) | |
def cross_validation(X, y, cv_size=0.1): | |
"""Run cross validation on a numpy ndarray and return corresponding indices as well | |
@param: X data in the form of numpy ndarray | |
@param: y labels in the form of numpy ndarray | |
@param: cv_size size of the test set |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
FROM python:3 | |
MAINTAINER Amir Rahnama "[email protected]" | |
COPY . /app | |
WORKDIR /app | |
RUN pip install -r requirement.txt | |
RUN pip install --editable . | |
ENV FLASK_APP mini/app.py |
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
"""A generic module to read data.""" | |
import numpy | |
import collections | |
from tensorflow.python.framework import dtypes | |
class DataSet(object): | |
"""Dataset class object.""" | |
def __init__(self, |
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
osrm: | |
command: './start.sh Sweden http://download.geofabrik.de/europe/sweden-latest.osm.pbf' | |
image: 'irony/osrm5:latest' | |
ports: | |
- '5000:5000' | |
volumes_from: | |
- osrm-data | |
osrm-data: | |
image: 'irony/osrm5:latest' | |
volumes: |
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
es-master: | |
image: 'elasticsearch:latest' | |
command: 'elasticsearch --network.host=0.0.0.0 --node.master=true --cluster.name=escluster' | |
restart: always | |
es-develop: | |
image: 'elasticsearch:latest' | |
command: 'elasticsearch --network.host=0.0.0.0 --cluster.name=escluster --discovery.zen.ping.unicast.hosts=es-master' | |
deployment_strategy: high_availability | |
links: | |
- es-master |
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
library(text2vec) | |
library(SnowballC) | |
library(doParallel) | |
library(microbenchmark) | |
library(tm) | |
con <- file("/Users/ara/dev/personal/r/final/en_US/en_US.blogs.txt", "r") | |
blogs <- readLines(con, encoding = 'UTF-8') | |
close(con) |
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
source("fast-ngrams.R") | |
con <- file("path_to_file", "r") | |
data <- readLines(con, encoding = 'UTF-8') | |
close(con) | |
data <- clean(data) | |
onegram <- text_to_ngrams(decode(data), 1) | |
bigram <- text_to_ngrams(decode(data), 2) | |
trigram <- text_to_ngrams(decode(data, 3)) |
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
--- | |
title: "Capstone First Milestone Report: Feature Engineering" | |
author: "Amir Hossein Rahnama" | |
date: "11 June 2016" | |
output: html_document | |
--- | |
####Introduction | |
In this report, we are analyzing I have tried to start by showing a summary of all three data source from SwiftKey in terms of size. You can obtain the data with following code: | |
```{r eval=FALSE} |
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
# pip install websocket-client | |
from pyspark import SparkContext | |
from pyspark.streaming import StreamingContext | |
from websocket import create_connection | |
def take_rdd_send_to_socket(time, rdd, num=1000): | |
result = [] | |
taken = rdd.take(num + 1) | |
print("-------------------------------------------") | |
print("Time: %s" % time) |
NewerOlder