Skip to content

Instantly share code, notes, and snippets.

Ieva Zarina IevaZarina

Block or report user

Report or block IevaZarina

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@IevaZarina
IevaZarina / xgboost_iris_prediction.py
Last active Nov 4, 2019
Simple demo script for running Xgboost
View xgboost_iris_prediction.py
# Ieva Zarina, 2016, licensed under the Apache 2.0 licnese
import numpy as np
import xgboost as xgb
from sklearn import datasets
from sklearn.cross_validation import train_test_split
from sklearn.datasets import dump_svmlight_file
from sklearn.externals import joblib
from sklearn.metrics import precision_score
@IevaZarina
IevaZarina / aho-corasick-automata.py
Created Nov 24, 2016
Simple test case for aho-corasick automata for keyword search.
View aho-corasick-automata.py
import ahocorasick as ahc
keywords = [
('he', 1),
('she', 1),
('hers', 1),
('her', 1)
]
text = [
@IevaZarina
IevaZarina / text_cleaning.py
Last active Feb 8, 2018
Cleaning lines of text
View text_cleaning.py
# -*- coding: utf-8 -*-
# Ieva Zarina, 2016, licensed under the Apache 2.0 licnece
import re
def is_digit(word):
try:
int(word)
return True
except ValueError:
@IevaZarina
IevaZarina / simple-supervised-knn.py
Created Jun 16, 2017
Simple supervised KNN classification in Python 2.7
View simple-supervised-knn.py
# knn
import math
from collections import defaultdict
from operator import itemgetter
# Some handmade train/test data
X_train = [
[1, 1],
@IevaZarina
IevaZarina / depth-first-search.py
Created Nov 7, 2016
Simple depth-first searcher in Python 2.7
View depth-first-search.py
'''
Depth-first searcher
Tree:
a
/ \
b c
/|\ \
d e f g
|
View plot_without_ui.py
import matplotlib.pyplot as plt
from sklearn import datasets
from sklearn.decomposition import TruncatedSVD
# Enable saving plot to png file without UI
plt.switch_backend('agg')
iris = datasets.load_iris()
X = iris.data
y = iris.target
View animals.json
"'{\"animal_list\": [{\"type\": \"mammal\", \"description\": \"Tall, with brown spots, lives in Savanna\", \"name\": \"Giraffa camelopardalis\"},{\"type\": \"mammal\", \"description\": \"Big, grey, with big ears, smart\", \"name\": \"Loxodonta africana\"},{\"type\": \"reptile\", \"description\": \"Green, changes color, lives in \"East Africa\"\", \"name\": \"Trioceros jacksonii\"}]}'"
View GiftExchangePairGenerator.py
# -*- coding: utf-8 -*-
import random
def getRandomPerson(ppl):
return ppl[random.randint(0,len(ppl)-1)]
def good_pair(ignore_ppl, chosen1, chosen2):
for pair in ignore_ppl:
You can’t perform that action at this time.