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
# with study drill done that debugs the number entry for gold | |
from sys import exit | |
def gold_room(): | |
print "This room is full of gold. How much do you take?" | |
while True: | |
try: | |
choice = raw_input("> ") | |
how_much = int(choice) |
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
data = load('ex1data2.txt'); % loads from array of 47x3 (x1, x2, y) | |
X = data(:, 1:2); % takes first two columns from the array we loaded | |
X_norm = X; | |
mu = zeros(1, size(X, 2)); % work out mean for each column in X | |
sigma = zeros(1, size(X, 2)); % work out stdev for each column in X | |
for i = 1:size(X,2) | |
mu(1,i) = mean(X(:,i)) % find mean for each column of X |
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
#!python3 | |
import random | |
import tradesimulator as ts | |
import sys | |
behaviourarray = { | |
'takerisk': ts.TakeRisk(), | |
'avoidrisk': ts.AvoidRisk(), | |
'findarbs': ts.FindArbs(), | |
} |
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
CFLAGS = -lm -lrt | |
INCS = parser.h | |
TARGET = test_parser | |
SOURCES = parser.c $(TARGET).c | |
CC = gcc | |
all: $(TARGET) | |
$(TARGET): $(SOURCES) $(INCS) | |
$(CC) $(SOURCES) -o $(TARGET) $(CFLAGS) |
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
'use strict'; | |
var Promise = require('bluebird'); | |
var sqlite3 = require('sqlite3'); | |
var db = new sqlite3.Database('testDB.db'); | |
var validator = require('validator'); | |
var has = require('has'); | |
exports.index = function(req, res){ | |
res.render('register', {title: 'register'}); | |
}; |
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 csv | |
from collections import defaultdict | |
#rawdate is format of ['CaptureEventID', 'ClassificationID', 'UserID', 'Species', 'Count', 'Standing', 'Resting', 'Moving', 'Eating', 'Interacting', 'Babies'] | |
#requires raw_data, and all_images | |
#lets remove the instances where there is more than 1 animal in a still and when there is a human | |
with open('D:\SnapshotSerengeti\consensus_data.csv', newline='') as rawdata,\ | |
open('D:\SnapshotSerengeti\curated.csv','w', newline='') as curated,\ | |
open('D:\SnapshotSerengeti\\all_images.csv', newline='') as images: |
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 csv | |
import os.path | |
import itertools | |
from collections import defaultdict | |
data_path = '/home/naan/SnapshotSerengeti/data/' | |
def raw_sampler(rawfile, outfile, n=500): | |
raw_path = os.path.join(data_path, rawfile) | |
sample_path = os.path.join(data_path, outfile) |
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
def remove_repeats(df): | |
df = df.assign(is_giraffe=lambda x: x.Species == 'giraffe') | |
df = df.sort_values('is_giraffe') | |
df = df.drop_duplicates(['URL_Info'], keep='last') | |
return df | |
clean_df = remove_repeats(test) | |
!ls -1 '/home/naan/SnapshotSerengeti/data/resized/' | wc -l |
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 keras.utils.io_utils import HDF5Matrix | |
import random | |
import numpy as np | |
random.seed(52) | |
sub_sample = 0.01 | |
data_path = '/home/naan/SnapshotSerengeti/data/SnapshotSerengeti224.h5' |
OlderNewer