let binomial (n: int) (k: int) : float = if k > n || n<0 || k<0 then domain () else (fact n) /. ((fact k) *. (fact (n - k))) ;;


let distance ((x1, y1): (int * int)) ((x2, y2): (int * int)) : float = if x1<0 || y1<0 || x2<0 || y2<0 then domain () else let dx = float_of_int (x2 - x1) in let dy = float_of_int (y2 - y1) in sqrt ( (dx *. dx) +. (dy *. dy) ) ;;


let rec fact (n: int): float = match n with | 0 -> 1. | _ -> (float_of_int(n) *. fact (n - 1)) ;;


let binomial (n: int) (k: int) = fact n /. (fact k *. fact (n - k));;


let distance ((x1, y1): (int * int)) ((x2, y2): (int * int)) : float = let dx = x1 - x2 in let dy = y1 - y2 in sqrt (float_of_int(dx * dx + dy * dy)) ;;


let is_prime n : bool = let rec counter x : bool = if x * x <= n then if n mod x = 0 then false else counter (x + 1) else true in counter 2;; let pi = 4. *. atan(1.);;


Speaker 1: It's been an hour and not one of my classmates has shown up! I tell you, when I actually die some people are gonna get seriously haunted!

Speaker 2: There you go! Someone came!

Speaker 1: Ok, ok! I'm gonna go hide! Oh, this is so exciting, my first mourner!

Speaker 3: Hi, glad you could come.

Speaker 2: Please, come in.

Speaker 4: Hi, you're Chandler Bing, right? I'm Tom Gordon, I was in your class.

Speaker 2: Oh yes, yes... let me... take your coat.

Speaker 4: Thanks... uh... I'm so sorry about Ross, it's...

Speaker 2: At least he died doing what he loved... watching blimps.

Speaker 1: Who is he?

Speaker 2: Some guy, Tom Gordon.

Speaker 1: I don't remember him, but then again I touched so many lives.

Speaker 3: So, did you know Ross well?

Speaker 4: Oh, actually I barely knew him. Yeah, I came because I heard Chandler's news. D'you know if he's seeing anyone?

Speaker 3: Yes, he is. Me.

Speaker 4: What? You... You... Oh! Can I ask you a personal question? Ho-how do you shave your beard so close?

Speaker 2: Ok Tommy, that's enough mourning for you! Here we go, bye bye!!

Speaker 4: Hey, listen. Call me.

Speaker 2: Ok!

Speaker 2
Speaker 2
Speaker 4
Speaker 4
Speaker 4
Speaker 1

Chandler Bing
Speaker 4
Tom Gordon
Speaker 2
Tommy
Tommy


Speaker 1: So, eh... it's probably gonna be hard for you to leave Boston, huh?

Speaker 2: Actually, I'm kinda happy to be leaving... I just broke up with someone.

Speaker 1: Ooh... so sad... Still, it can't be easy for you to leave Harvard? Especially after working alongside a Nobel Prize winner like Albert Wintermeyer?

Speaker 2: Actually, Alby is the guy I broke up with.

Speaker 1: You... you dated Albert Wintermeyer?

Speaker 2: Yeah...

Speaker 1: ... And you called him Alby!? I mean that's like... like calling Albert Einstein... er... Alby...

Speaker 2: Yeah, well, he is a brilliant man.

Speaker 1: Eh, you think? I mean, you went out with a guy who improved the accuracy of radiocarbon dating by a factor of 10!

Speaker 2: Yes! And while that is everything one looks for in a boyfriend, he had a lot of issues...

Speaker 1: Oh! like what?! Oh I'm sorry, I don't mean to pry... it's just that this must be what regular people experience when they watch "Access Hollywood".

Speaker 2: Ok, you want the dirt? Alby was seriously insecure. I mean, he was really intimidated by the guy I dated before him.

Speaker 1: Who is intimidating to a guy who won the Nobel Prize?

Speaker 2: A guy who won two.

Speaker 1: Two? Wha...? Don't tell me you dated Benjamin Hobart

Speaker 2: Yeah... for three years.

Speaker 1: Oh my God! Have you ever been in a relationship with someone who hasn't won the Nobel Prize?

Speaker 2: ... no... bu but there was my first boyfriend Billy.

Speaker 1: Oh yeah? no, no Nobel Prizes for him?

Speaker 2: No, but he did just win the McArthur genius grant.

Speaker 1: Huh... huh... what a loser! Some more wine?

Speaker 2
Speaker 2
Speaker 2
Speaker 2
Speaker 2
Albert Wintermeyer
Albert Wintermeyer
Albert Wintermeyer
Speaker 1
Speaker 1
Speaker 1
Billy
Billy
Boston
Benjamin Hobart
Harvard

Boston
Harvard
Albert Wintermeyer
Benjamin Hobart
Billy
Nobel Prize winner
Alby
Speaker 2
Albert Wintermeyer
man
loser
a loser
Speaker 2
Speaker 2
Speaker 2
Speaker 2

PER PER PER PER PER PER PER PER PER PER PER PER PER GPE PER ORG

GPE ORG PER PER PER STRING PER PER PER STRING STRING STRING PER PER PER PER


Speaker 1: Hi.

Speaker 2: Hi.

Speaker 1: I just finished getting Phoebe all dressed to meet Mike's parents. She's so nervous, it's so sweet!

Speaker 2: Guess what? I made Emma laugh today.

Speaker 1: You WHAT? And I missed it? Because I was giving a makeover to that stupid hippie?

Speaker 2: Yeah, and it was uhm... it was like a real little person laugh too. It was... it was like uhm... Only... only not creepy.

Speaker 1: Well... well, what did you do to make her laugh?

Speaker 2: I uhm... Well, I sang... well actually I rapped... Baby Got Back...

Speaker 1: You WHAT? You sang... to our baby daughter... a song about a guy who likes to have sex with women with giant asses?

Speaker 2: But you know what, if you think about it, it actually promotes a healthy uhm... body image... because... even big butts or uhm... juicy doubles.

Speaker 1: owwwww...

Speaker 2: Please don't take her away from me!

Phoebe
Phoebe
Mike
Speaker 2
Speaker 2
Speaker 1
Speaker 1
Emma
Emma
Emma

Mike
stupid hippie
Phoebe
Emma
Baby
Emma
Baby
Speaker 2
Speaker 1
Baby Got Back

PER STRING PER PER STRING PER STRING PER PER STRING


Speaker 1: 'Okay. Okay, daddy we'll see you tomorrow night. Okay bye-bye.'

Speaker 2: We?

Speaker 1: Are ah, having dinner with my Dad tomorrow night, I hope that's okay.

Speaker 2: Oh shoot, tomorrow's not so good, I'm supposed to um, fall off the Empire State building and land on a bicycle with no seat. Sorry.

Speaker 1: Ross, my father doesn't hate you.

Speaker 2: Please, he refers to me as 'wethead'.

Speaker 1: But honey he calls everybody by a nickname! Okay, look, I know, all right, just one dinner, please, just one night for me, please. I just want him to love you like I do.

Speaker 2
Speaker 2
Speaker 2
Speaker 2
Speaker 1
Speaker 1

wethead
honey
Speaker 1
daddy
Speaker 2
honey


Speaker 1: Hey Pheebs.

Speaker 2: Hey!

Speaker 1: Any sign of your brother?

Speaker 2: No, but he's always late.

Speaker 1: I thought you only met him once?

Speaker 2: Yeah, I did. I think it sounds y'know big sistery, y'know, 'Frank's always late.'

Speaker 1: Well relax, he'll be here.


Speaker 1: Monica.

Speaker 2: Oh my God! He just said my name! Did you hear that?

Speaker 1: Monica bang!

Speaker 3: Okay, I heard that.

Speaker 2: Did he just say 'Monica bang'?

Speaker 3: Uh-huh.

Speaker 2: Oh my God! He's gonna rat me out!

Speaker 1: Monica bang!

Speaker 2: Oh-ho-ho, sweetie, sweetie, you gotta stop saying that, now. It's no big deal, it's not even worth mentioning, you see we all do it all the time. See watch this, Ben, Ben, Ben. Ow, Monica bang! Everybody bang. Ben bang. Rachel bang. Bang, Rachel bang! Oh, isn't that fun?

Speaker 3:  Look at that! Look at that! We all do it. Okay, I'm stopping now.

Speaker 2: You okay?

Speaker 3: Oh yeah! Y'know, if it's not a headboard, it's just not worth it.

Speaker 2
Speaker 2
Speaker 1
Speaker 3
Speaker 3

Monica bang
sweetie
sweetie
Rachel bang
sweetie


Speaker 1: Oh hey! Wait up!

Speaker 2: Hi!

Speaker 1: Congratulations! I didn't want to say anything in front of Joey because I didn't know if he knew yet.

Speaker 2: What, that we had a baby? Come on let's give him a little credit, although he did eat a piece of plastic fruit earlier.

Speaker 1: No! No, that you and Rachel are engaged!

Speaker 2: What?

Speaker 1: Oh, it's a secret. Oh goodie! Yes! We haven't done the secret thing in a long time.

Speaker 2: Phoebe, there is no secret. Okay? I didn't propose.

Speaker 1: Are you lying? Is this like that time you tried to convince us that you were a doctor?

Speaker 2: I am a doctor! Y'know what? I'm just gonna go and talk to Rachel myself.

Speaker 1: All right, me too. Should we wake her up?

Speaker 2: No! No, come on let her sleep! She's so exhausted.


Speaker 1: Over here Jack. OK. I see, Rachel's coming up the path. Oh doesn't she look pretty. Jack, get this.

Speaker 2: Get a shot of Monica. Where's Monica.

Speaker 3: Over here dad.

Speaker 4: Wait, how do you zoom out? There she is.

Speaker 3: Oh, you look so great.

Speaker 5: Ahh, so do you, beautiful.

Speaker 3: Oops.

Speaker 5: What?

Speaker 3: Shoot, I think I got mayonaise on you.

Speaker 5: Oh, that's OK, it's just the shoulder, it's not my dress.

Speaker 4: Everybody smile.

Speaker 3: Oh, dad, turn it off.

Speaker 4: It is off.

Speaker 3: Dad, it is not. What's with the red light?

Speaker 4: It's the off light. Right Ross?

Speaker 6: You look pretty tonight.

Speaker 5: Oh, thanks. So, uh, what are you gonna do this summer?

Speaker 6: Oh, you know, I'm just gonna, I'm gonna hang out, work on my music.

Speaker 5: Is my hook unhooked? These things keep falling down, I can't. . .

Speaker 6: Uh, hold, let me see, I don't know. So what're you gonna do. . .

Speaker 5: Oh, the guys are here.

Speaker 6: this summer?


Speaker 1: Alright, wait a second, why would Ross tell everyone in your class that you are as... "gay as the day is long"?

Speaker 2: Because I told everyone he slept with dinosaurs.

Speaker 1: But that's clearly a joke. This could easily be true.

Speaker 2: Would you get that please? People have been calling to congratulate me all day.

Speaker 1: Hello? No, he's not here. Yeah, this is his wife. Yeah, well, it came as quite a shock to me too. I guess I should have known. Yeah, I mean, he just kept making me watch Moulin Rouge.

Speaker 2: Hang up, hang up. And that was a great movie! I'm so gonna get back at Ross... oh yeah, this will show him, here we go.

Speaker 1: What are you doing?

Speaker 2: Oh, you'll see my friend.

Speaker 1
Speaker 1
Speaker 2
Speaker 2
Speaker 2
Speaker 2
Ross

my friend
Speaker 2
Ross
Speaker 1
Moulin Rouge
my friend
Speaker 2


#
#pocket Algorithm
#

import numpy as np
import matplotlib.pyplot as plt
import scipy.stats as stats
import random

##############################################
def sepLine(w, x):
    return -((w[0]+w[1]*x)/w[2])
#end

def drawSepLine(w, minX, maxX):
    sepx = range(minX, maxX)
    sepy = []
    for e in sepx:
        tmp = sepLine(w, e)
        sepy.append( tmp )
    #end for
    plt.plot(sepx, sepy )
#end drawSepLine
##############################################

ls=np.array([
[1.0, 0.5,   1]
,[1.5, 14.5,  1]
,[2.5, 1.5,   1]
,[2.8, 3.5,  1]
,[4.5, 13.0,  1]
,[6.0, 8.0,  1]
,[7.0, 16.0,  1] #noize data
,[8.0, 5.5,  1]
,[9.5, 7.0,  1]
,[12.0, 2.5,  1]
,[14.0, 2.0,  1]
#,[7.0, 16.0,  1] #noize data
])
rs=np.array([
[2.0, 18.0, -1]
,[3.0, 17.5, -1]
,[3.5, 0.7, -1] #noize data
,[8.0,11.5, -1]
,[8.5,13.5, -1]
,[8.5,13.0, -1]
,[9.0,15, -1]
,[12.0,20.0,-1]
,[16.0,17.0,-1]
#,[3.5, 0.7, -1] #noize data
])

##construct training data
rtd = np.concatenate((ls,rs))
minX = (int)(np.min(rtd[:,:1]))-3
maxX = (int)(np.max(rtd[:,:1]))+3

###plot the data
plt.xlim( (minX, maxX) )
plt.ylim( (np.min(rtd[:,1:2]-3), np.max(rtd[:,1:2]+3)) )
plt.plot(ls[:,:1], ls[:, 1:2], '*')
plt.plot(rs[:,:1], rs[:, 1:2], '+')

##############pla-begin
x0 = np.zeros( (len(rtd), 1) )
x0[:]=1.0
td = np.concatenate( (x0, rtd[:,:1], rtd[:,1:2], rtd[:,2:3]), 1 )

#The this initial value of w. td[0] include y. so we need to minus 1
w=np.zeros( len(td[0])-1 );

#todo:we can set it as max of float
weighOfPocket=1000000000.0
wPocket=w

#
#ensure all point corret
#maxIter=900000
maxIter=1200000
weighOfPocketThres=0.05

curIter=0
while(curIter<maxIter):
    curIter = curIter +1;

    #[begin----the following is typical pla----
    isModifing=False;
    #check each point for w
    for ti in range(len(td)):
        rndIdx=random.randint(0, len(td)-1)
        sample = td[rndIdx]
        sx = sample[:len(sample)-1]; sy=sample[len(sample)-1]
        t = np.inner(w, sx)
        ty = np.sign(t)
        #print(idx, ty, sy)
        if(ty!=sy):
            #failed, we need to update w
            w = w + sy*sx
            isModifing = True
        #end if
    #end for
    if(isModifing==False):
        break;
        #todo. we need to update pocket here.
    #end]

    #pick up an element in sample to try to improve w
    #rndIdx=random.randint(0, len(td)-1)
    #sample = td[rndIdx]
    #sx = sample[:len(sample)-1]; sy=sample[len(sample)-1]
    #w = w + sy*sx

    #It's too late to check weight for this w
    #calc weight for w
    weight=0.;
    for idx in range(len(td)):
        sample = td[idx]
        sx = sample[:len(sample)-1]; sy=sample[len(sample)-1]
        t = np.inner(w, sx)
        ty = np.sign(t)
        #print(idx, ty, sy)
        if(ty!=sy):
            weight += 1.0;
    #end for

    #print("The curIter is ", curIter)
    #print("The weighOfPocket is ", weighOfPocket)
    #print("The w is ", w)
    #drawSepLine(w, minX, maxX)

    #if the new w is better than stuff in pocket, then update stuff in pocket
    if(weight<weighOfPocket):
        weighOfPocket = weight
        wPocket = w
    #end if

    if(weighOfPocket<weighOfPocketThres):
        break;
#end for

##############pla-end
print("The curIter is ", curIter)
print("The weighOfPocket is ", weighOfPocket)
print("The w is ", w)

#show the seperator line
drawSepLine(w, minX, maxX);

###
#In [93]: import pla
#In [94]: reload(pla)
#
if __name__ =="__main__":
    pass
#end


#!/usr/bin/python
# -*- coding: utf-8 -*-

import collections

import pulp
from numpy import dot
from pandas import DataFrame, read_table
from scipy.sparse import csgraph

class Controls:
    def __init__(self, accepted_demand: DataFrame, product_bid_prices: DataFrame, expected_revenue: float = None):
        self.accepted_demand = accepted_demand
        self.product_bid_prices = product_bid_prices
        self.expected_revenue = expected_revenue

class Problem:
    def __init__(self, demand_vector, price_vector, capacity_vector, demand_utilization_matrix, demand_profile=None):
        self.demand_vector = demand_vector
        self.price_vector = price_vector
        self.capacity_vector = capacity_vector
        self.demand_utilization_matrix = demand_utilization_matrix
        self.demand_profile = demand_profile
        self.demand_correlations = self.get_demand_correlations()

    def get_demand_correlations(self):
        return dot(self.demand_utilization_matrix, self.demand_utilization_matrix.transpose())

    def get_subproblems(self, eps=0.1):
        subproblems = []
        labels = csgraph.connected_components(self.demand_correlations, directed=False)[1]
        split_index = collections.Counter(labels).values()
        prev = 0
        for i in split_index:
            demand_vector = self.demand_vector[prev:prev + i]
            price_vector = self.price_vector[prev:prev + i]
            capacity_vector = self.capacity_vector
            demand_utilization_matrix = self.demand_utilization_matrix.ix[prev:prev + i, :]
            demand_profile = None
            if self.demand_profile is not None:
                demand_profile = self.demand_profile.ix[prev:prev + i - 1, :]
            subproblems.append(
                Problem(demand_vector=demand_vector, price_vector=price_vector, capacity_vector=capacity_vector,
                        demand_utilization_matrix=demand_utilization_matrix, demand_profile=demand_profile))
            prev = i
        return subproblems

class Solver:
    def __init__(self, optimizer):
        self.optimizer = optimizer
        self.controls = None

    def optimize_controls(self, problem):
        self.controls = pulp_solve(problem.demand_vector, problem.price_vector, problem.capacity_vector,
                                   problem.demand_utilization_matrix)
        return self.controls

    def optimize_controls_multi_period(self, problem, eps):
        if problem.demand_profile.shape[1] > 1:
            for period in problem.demand_profile.columns:
                if self.controls:
                    new_control = pulp_solve(problem.demand_profile.ix[:, period], problem.price_vector,
                                             problem.capacity_vector,
                                             problem.demand_utilization_matrix)
                    if self.is_new_ctrl_more_profitable(new_control, 0.1):
                        self.blinde_control(new_control, eps)
                else:
                    self.controls = self.optimize_controls(problem)
        else:
            self.controls = self.optimize_controls(problem)
        return self.controls

    def is_new_ctrl_more_profitable(self, new_control, eps):
        rev1 = self.controls.expected_revenue
        if new_control.expected_revenue - rev1 > rev1 * eps:
            return True
        return False

    def blinde_control(self, new_control, eps):
        self.controls.accepted_demand = self.controls.accepted_demand * eps
        self.controls.product_bid_prices = self.controls.product_bid_prices / eps
        self.controls.expected_revenue = new_control.expected_revenue

def to_data_frame(data):
    df = DataFrame.transpose(read_table(data, delim_whitespace=True, header=None))
    df.columns = [(col + 1) for col in df.columns]
    return df

def to_data_frame2(data):
    df = DataFrame(read_table(data, delim_whitespace=True, header=None))
    return df

def create_problem_with_data(demand_data, capacity_data, demand_utilization_data, demand_profile_data=None):
    demand_vector, capacity_vector, demand_profile, demand_utilization_matrix = load_data_to_df(capacity_data,
                                                                                demand_data,
                                                                                demand_profile_data,
                                                                                demand_utilization_data)
    return Problem(demand_vector.ix[:, 1], demand_vector.ix[:, 2], capacity_vector,
                   demand_utilization_matrix.ix[:, :],
                   demand_profile)

def merge_controls(controls_list):
    first_time = True
    for controls in controls_list:
        if first_time:
            accepted_demand = controls.accepted_demand
            product_bid_prices = controls.product_bid_prices
            expected_revenue = controls.expected_revenue
            first_time = False
        else:
            accepted_demand = accepted_demand.append(controls.accepted_demand)
            product_bid_prices = product_bid_prices.append(controls.product_bid_prices)
            expected_revenue = expected_revenue + controls.expected_revenue

    return Controls(accepted_demand=accepted_demand, product_bid_prices=product_bid_prices,
                    expected_revenue=expected_revenue)

def load_data_to_df(capacity_data, demand_data, demand_profile_data, demand_utilization_data):
    demand_vector = to_data_frame(demand_data)
    capacity_vector = to_data_frame(capacity_data)
    demand_utilization_matrix = to_data_frame2(demand_utilization_data)
    assert demand_utilization_matrix.shape[0] == demand_vector.shape[0]
    assert demand_utilization_matrix.shape[1] == capacity_vector.shape[0]
    if demand_profile_data:
        demand_profile = to_data_frame(demand_profile_data)
        assert demand_profile.shape[0] == demand_vector.shape[0]
    else:
        demand_profile = None
    return demand_vector, capacity_vector, demand_profile, demand_utilization_matrix

def pulp_solve(demand_vector, price_vector, capacity_vector, demand_utilization_matrix):
    revman = create_problem()
    x = create_variables(demand_vector)
    set_objective(demand_vector, price_vector, revman, x)
    add_product_constraints(capacity_vector, demand_utilization_matrix, demand_vector, revman, x)
    add_demand_constraints(demand_vector, revman, x)

    solve_problem(revman)

    accepted_demand = get_accepted_demand(x)
    product_bid_prices = get_bid_prices(capacity_vector, revman)
    expected_revenue = get_expected_revenue(revman)

    return Controls((accepted_demand), (product_bid_prices), expected_revenue)

def solve_problem(revman):
    revman.solve(pulp.PULP_CBC_CMD())
    # revman.writeLP("temp.txt")
    # print(pulp.LpStatus[revman.status])

def create_problem():
    return pulp.LpProblem("revman", pulp.LpMaximize)

def get_expected_revenue(revman):
    return pulp.value(revman.objective)

def get_accepted_demand(x):
    return DataFrame({'accepted_demand': [(x[str(i)].value()) for i in x]})

def get_bid_prices(capacity_vector, revman):
    bid_prices_list = [revman.constraints.get("Capa_" + str(i)).pi for (i, c) in (capacity_vector.iterrows())]
    return DataFrame({'bid_prices_list': bid_prices_list})

def add_demand_constraints(demand_vector, revman, x):
    for (demand_index, demand) in (demand_vector.iteritems()):
        revman.addConstraint((x[str(demand_index)]) <= demand, name="Demand_" + str(demand_index))

def add_product_constraints(capacity_vector, demand_utilization_matrix, demand_vector, revman, x):
    for (product_index, capacity) in (capacity_vector.iterrows()):
        revman.addConstraint(pulp.lpSum(
            [x[str(i)] * demand_utilization_matrix.ix[i, product_index] for (i, d) in demand_vector.iteritems()]) <=
                             capacity,
                             name="Capa_" + str(product_index))

def set_objective(demand_vector, price_vector, revman, x):
    objective = pulp.LpAffineExpression([(x[str(i)], price_vector[i]) for (i, d) in demand_vector.iteritems()])
    revman.setObjective(objective)

def create_variables(demand_vector):
    x = dict([(str(i), pulp.LpVariable(name="x" + str(i), lowBound=0, cat=pulp.LpContinuous)) for (i, t) in
              demand_vector.iteritems()])
    return x


from random import shuffle
import matplotlib.pyplot as plt
import seaborn as sns
import pandas as pd
import csv
import argparse
import os
import shutil

"""
The script required for the data analysis. Requires several python libraries
to function but otherwise isn't too complicated.
"""

def generate_all_graphs():
    number_of_subjects = len(os.listdir("../subject logs")) - 1

    for i in range(1, number_of_subjects + 1):
        try:
            os.mkdir("Subject {}".format(i))
        except FileExistsError:
            shutil.rmtree("Subject {}".format(i))
            os.mkdir("Subject {}".format(i))

        transparency_log_1, transparency_log_2, transparency_log_3, \
            transparency_log_4 = load_subject_data(i)

        individual_graph(transparency_log_1, transparency_log_2, "Easy", i,
                         False)
        individual_graph(transparency_log_3, transparency_log_4, "Hard", i,
                         False)

        print("Generated graphs for subject {}".format(i))

def individual_graph(transparencies_1, transparencies_2, condition,
                     subject_number, display_graph=True):

    x = [i for i in range(1, 81)]
    sns.pointplot(x, transparencies_1, color='red')
    plot = sns.pointplot(x, transparencies_2)
    plot.set(xlabel="Trial", ylabel="Contrast",
             title="{} Condition".format(condition))
    if display_graph:
        plt.show()
    plot = plot.get_figure()
    plot.savefig("Subject {}/{}.png".format(subject_number, condition))
    plt.cla()

def find_turning_points(series):

    turning_points = []
    last_point = len(series) - 1

    for i, point in enumerate(series):
        if i != 0 and i != last_point:
            if (point < series[i - 1] and point < series[i + 1]) or \
                    (point > series[i - 1] and point > series[i + 1]):

                turning_points.append(point)

    return turning_points

def find_threshold(log_1, log_2):

    average_1 = 0
    average_2 = 0

    turning_points_1 = find_turning_points(log_1)

    if turning_points_1:
        average_1 = sum(turning_points_1)/len(turning_points_1)
    else:
        average_1 = 0

    turning_points_2 = find_turning_points(log_2)

    if turning_points_2:
        average_2 = sum(turning_points_2)/len(turning_points_2)
    else:
        average_2 = 0

    return (average_1 + average_2)/2

def load_subject_data(subject_number):
    filename = "../subject logs/subject {}.csv".format(subject_number)

    with open(filename, 'r') as f:
        reader = csv.reader(f)
        data = list(reader)[1:]

    transparency_log_1 = [trial[1] for trial in data]
    transparency_log_2 = [trial[3] for trial in data]
    transparency_log_3 = [trial[5] for trial in data]
    transparency_log_4 = [trial[7] for trial in data]

    transparency_log_1 = list(map(lambda x: float(x), transparency_log_1))
    transparency_log_2 = list(map(lambda x: float(x), transparency_log_2))
    transparency_log_3 = list(map(lambda x: float(x), transparency_log_3))
    transparency_log_4 = list(map(lambda x: float(x), transparency_log_4))

    return (transparency_log_1, transparency_log_2, transparency_log_3,
            transparency_log_4)

def check_subject_validity(subject_number):
    with open('../subject logs/catch trials.csv', 'r') as f:
        reader = csv.reader(f)
        data = list(reader)

    subject_info = data[subject_number]

    catch_trials_valid = int(subject_info[1]) > 29 and int(subject_info[2]) < 5

    with open('../memory_results_after.csv', 'r') as f:
        reader = csv.reader(f)
        data = list(reader)

    subject_info = data[subject_number]

    remembered_names_correctly = subject_info[2] == subject_info[3] and \
        subject_info[4] == subject_info[5] and \
        subject_info[6] == '' and \
        subject_info[7] == ''

    return catch_trials_valid and remembered_names_correctly

def graph_subject(subject_number):
        try:
            os.mkdir("Subject {}".format(subject_number))
        except FileExistsError:
            shutil.rmtree("Subject {}".format(subject_number))
            os.mkdir("Subject {}".format(subject_number))
        transparency_log_1, transparency_log_2, transparency_log_3, \
            transparency_log_4 = load_subject_data(subject_number)

        individual_graph(transparency_log_1, transparency_log_2, "Easy",
                         subject_number)

        average_easy = find_threshold(transparency_log_1,
                                      transparency_log_2)

        print("Subject average for easy condition is {}".format(average_easy))

        individual_graph(transparency_log_3, transparency_log_4, "Hard",
                         subject_number)

        average_hard = find_threshold(transparency_log_3,
                                      transparency_log_4)

        print("Subject average for hard condition is {}".format(average_hard))

        valid = check_subject_validity(int(subject_number))

        if valid:
            print("Subject is valid")
        else:
            print("Subject is invalid")

def show_summary_graph():

    number_of_subjects = len(os.listdir("../subject logs")) - 1

    subject_data = []
    for i in range(1, number_of_subjects + 1):
        transparency_log_1, transparency_log_2, transparency_log_3, \
            transparency_log_4 = load_subject_data(i)

        easy_threshold = find_threshold(transparency_log_1, transparency_log_2)
        hard_threshold = find_threshold(transparency_log_3, transparency_log_4)

        subject_data.append((i, easy_threshold, "Easy",
                             check_subject_validity(i)))
        subject_data.append((i, hard_threshold, "Hard",
                             check_subject_validity(i)))

    df = pd.DataFrame(subject_data, columns=["Subject", "Threshold",
                                             "Condition", "Valid"])

    print(df)

    plot = sns.factorplot(data=df,
                          x="Subject",
                          y="Threshold",
                          hue="Condition",
                          linestyles=[" ", " "],
                          legend=False,
                          size=8,
                          aspect=2)
    plt.legend(loc='upper left')

    plot.set(xlabel="Subject Number",
             ylabel="Contrast",
             title="Summary of all subjects")

    plt.show()

    plot.savefig("Summary.png")

def generate_results_file():

    number_of_subjects = len(os.listdir("../subject logs")) - 1

    table = []
    for i in range(1, number_of_subjects + 1):
        transparency_log_1, transparency_log_2, transparency_log_3, \
            transparency_log_4 = load_subject_data(i)

        easy_threshold = find_threshold(transparency_log_1, transparency_log_2)
        hard_threshold = find_threshold(transparency_log_3, transparency_log_4)

        valid = check_subject_validity(i)

        with open('../memory_results_after.csv', 'r') as f:
            reader = csv.reader(f)
            data = list(reader)

        subject_info = data[i]

        round_number = subject_info[1]

        table.append([i, round_number, easy_threshold, hard_threshold, valid])

    table = pd.DataFrame(table, columns=["Subject", "Round number",
                                         "Easy Threshold", "Hard Threshold",
                                         "Valid"])

    table.to_csv("Summary.csv")

    print("Results file can be found in Summary.csv")

def main():

    plt.rcParams['figure.figsize'] = (18, 8)

    parser = argparse.ArgumentParser()
    group = parser.add_mutually_exclusive_group(required=True)
    group.add_argument("-i", "--individual",
                       help="Analyze a particular subject",
                       action="store", metavar='')
    group.add_argument("-s", "--summary", help="See a summary graph",
                       action="store_true")
    group.add_argument("-r", "--result", help="Create a results file",
                       action="store_true")
    args = parser.parse_args()

    if args.individual:
        if args.individual == 'a':
            generate_all_graphs()
        else:
            graph_subject(args.individual)
    if args.summary:
        show_summary_graph()
    if args.result:
        generate_results_file()

if __name__ == '__main__':
    main()


# -*- coding: utf-8 -*-
"""A quick look at volatility of stock returns for 2009

Just an exercise to find my way around the pandas methods.
Shows the daily rate of return, the square of it (volatility) and
a 5 day moving average of the volatility.
No guarantee for correctness.
Assumes no missing values.
colors of lines in graphs are not great

uses DataFrame and WidePanel to hold data downloaded from yahoo using matplotlib.
I haven't figured out storage, so the download happens at each run
of the script.

getquotes is from pandas\examples\finance.py

Created on Sat Jan 30 16:30:18 2010
Author: josef-pktd
"""
from statsmodels.compat.python import lzip
import numpy as np
import matplotlib.finance as fin
import matplotlib.pyplot as plt
import datetime as dt

import pandas as pa

def getquotes(symbol, start, end):
    quotes = fin.quotes_historical_yahoo(symbol, start, end)
    dates, open, close, high, low, volume = lzip(*quotes)

    data = {
        'open' : open,
        'close' : close,
        'high' : high,
        'low' : low,
        'volume' : volume
    }

    dates = pa.Index([dt.datetime.fromordinal(int(d)) for d in dates])
    return pa.DataFrame(data, index=dates)

start_date = dt.datetime(2009, 1, 1)
end_date = dt.datetime(2010, 1, 1)

mysym = ['msft', 'ibm', 'goog']
indexsym = ['gspc', 'dji']

# download data
dmall = {}
for sy in mysym:
   dmall[sy]  = getquotes(sy, start_date, end_date)

# combine into WidePanel
pawp = pa.WidePanel.fromDict(dmall)
print(pawp.values.shape)

# select closing prices
paclose = pawp.getMinorXS('close')

# take log and first difference over time
paclose_ratereturn = paclose.apply(np.log).diff()
plt.figure()
paclose_ratereturn.plot()
plt.title('daily rate of return')

# square the returns
paclose_ratereturn_vol = paclose_ratereturn.apply(lambda x:np.power(x,2))
plt.figure()
plt.title('volatility (with 5 day moving average')
paclose_ratereturn_vol.plot()

# use convolution to get moving average
paclose_ratereturn_vol_mov = paclose_ratereturn_vol.apply(
                        lambda x:np.convolve(x,np.ones(5)/5.,'same'))
paclose_ratereturn_vol_mov.plot()

#plt.show()


import pandas as pd

def remove_nodes(network, rm_nodes):
    """
    Create DataFrames of nodes and edges that do not include specified nodes.

    Parameters
    ----------
    network : pandana.Network
    rm_nodes : array_like
        A list, array, Index, or Series of node IDs that should *not*
        be saved as part of the Network.

    Returns
    -------
    nodes, edges : pandas.DataFrame

    """
    rm_nodes = set(rm_nodes)
    ndf = network.nodes_df
    edf = network.edges_df

    nodes_to_keep = ~ndf.index.isin(rm_nodes)
    edges_to_keep = ~(edf['from'].isin(rm_nodes) | edf['to'].isin(rm_nodes))

    return ndf.loc[nodes_to_keep], edf.loc[edges_to_keep]

def network_to_pandas_hdf5(network, filename, rm_nodes=None):
    """
    Save a Network's data to a Pandas HDFStore.

    Parameters
    ----------
    network : pandana.Network
    filename : str
    rm_nodes : array_like
        A list, array, Index, or Series of node IDs that should *not*
        be saved as part of the Network.

    """
    if rm_nodes is not None:
        nodes, edges = remove_nodes(network, rm_nodes)
    else:
        nodes, edges = network.nodes_df, network.edges_df

    with pd.HDFStore(filename, mode='w') as store:
        store['nodes'] = nodes
        store['edges'] = edges

        store['two_way'] = pd.Series([network._twoway])
        store['impedance_names'] = pd.Series(network.impedance_names)

def network_from_pandas_hdf5(cls, filename):
    """
    Build a Network from data in a Pandas HDFStore.

    Parameters
    ----------
    cls : class
        Class to instantiate, usually pandana.Network.
    filename : str

    Returns
    -------
    network : pandana.Network

    """
    with pd.HDFStore(filename) as store:
        nodes = store['nodes']
        edges = store['edges']
        two_way = store['two_way'][0]
        imp_names = store['impedance_names'].tolist()

    return cls(
        nodes['x'], nodes['y'], edges['from'], edges['to'], edges[imp_names],
        twoway=two_way)


from getIQU import IQU
from subprocess import call
import sys,os
import numpy as np
import glob
import matplotlib
import matplotlib.pyplot as plt
from astropy.convolution import convolve, Gaussian2DKernel
from astropy.io import fits
import scipy.ndimage
from makePretty import pretty
import aplpy
from skimage import filters
#matplotlib.rcParams.update({'font.size':16})
save_files_here = "/home/wizwit/SESE_dissertation/figures/chapter6"
plt.ion()

if len(sys.argv) < 2:
    print "You must supply a band, 'e.g., carina_lic.py 250'"
    sys.exit()
else:
    band = sys.argv[1]

# Call this function with desired band as first argument, e.g.:
# python carina_lic.py 250
# lists over which to iterate:
bands = ['250', '350', '500']
stokes = ['I', 'Q', 'U']
pol_eff = [0.81, 0.79, 0.82]

# define file paths
blastpol_dir = './carinaData/smooth/3.0_arcmin'
filename = glob.glob(blastpol_dir + '/carinaneb_' + band + '_smoothed_3.0_rl.fits')[0]

# load in I, Q, U for desired band
Ivals, Qvals, Uvals, __, wcs = IQU(filename)

I = Ivals[30:-30,260:-260]
Q = Qvals[30:-30,260:-260]
U = Uvals[30:-30,260:-260]
Pvals = np.sqrt(Q**2 + U**2)
pvals = Pvals/I

# Correct pvals as in Jamil's thesis, 5.7
pvals[pvals > 0.5] = np.nan
pvals[pvals < 0] = np.nan
pvals /= pol_eff[bands.index(band)]
phi = 0.5*np.arctan2(U,Q)
#dx = np.cos(phi)
#dy = np.sin(phi)
dx = pvals*np.cos(phi)
dy = pvals*np.sin(phi)
mag = np.sqrt(dx**2 + dy**2)
X = np.linspace(0, I.shape[1], I.shape[1])
Y = np.linspace(0, I.shape[0], I.shape[0])
xs, ys = np.meshgrid(X,Y)

"""
plt.figure()
nskip = 2
skip = (slice(None, None, nskip), slice(None, None, nskip))
#f = aplpy.FITSFigure(I, figsize = (10.24,7.68), dpi = 100)
ax = plt.gca()
ax.imshow(I, cmap = "gist_heat")
#f.tick_labels.set_font(size='small')
#f.show_colorscale(cmap='gist_heat')
# Add polarization vectors
ax.quiver(xs[skip],ys[skip],(dx/mag)[skip],(dy/mag)[skip], color = "white", angles = 'xy', units = 'xy', scale_units = 'xy', scale = 0.3)
#f.show_vectors(pvals, phi, color = 'white', rotate = 90., scale = 50, step = 10)
ax.set_facecolor('black')
plt.tight_layout()
"""
xsize, ysize = len(X), len(Y)

vectors = np.array([dx,dy])
#white = np.random.rand(xsize, ysize)
#white = np.random.uniform(low = 0., high = 1., size = (xsize, ysize))
white = np.random.normal(0., 1., size = (xsize,ysize))
sigma = 1.2
white = scipy.ndimage.gaussian_filter(white, sigma)

with file('texture.dat', 'w') as outfile:
    for row in white:
        np.savetxt(outfile, row, newline = " ")
        outfile.write('\n')
with file('dx.dat', 'w') as outfile:
    for row in dx:
        np.savetxt(outfile, row, newline = " ")
        outfile.write('\n')
with file('dy.dat', 'w') as outfile:
    for row in dy:
        np.savetxt(outfile, row, newline = " ")
        outfile.write('\n')

if len(sys.argv) > 2:
    print
    print "Doing LIC"
    print
    command = ["./carina_lic", str(xsize), str(ysize)]
    call(command)

lic = np.loadtxt("./lic.dat")
lic = np.transpose(lic)
#np.save('lic.npy', lic)
#lic2 = np.load("lic.npy")
#lic = scipy.ndimage.gaussian_filter(lic, 1.01)
mult = lic * I

"""
blur_size = 8
unsharp_strength = 0.8
blurred = filter.gaussian_filter(lic, blur_size)
highpass = lic - unsharp_strength*blurred
sharp = lic + highpass
lowpass = scipy.ndimage.gaussian_filter(lic, 5)
highpass = lic - lowpass
highpass += lic
"""
"""
hdu2 = fits.PrimaryHDU(data=np.zeros_like(I), header=wcs.to_header())
f2 = aplpy.FITSFigure(hdu2, figsize = (10,10))
f2.set_theme('publication')
ax = plt.gca()
ax.set_facecolor("k")
f2.add_scalebar(15/60.) # arcmin
f2.scalebar.set_label('0.5 deg')
f2.scalebar.set_color('white')
f2.scalebar.set_corner('bottom right')
f2.scalebar.set_label('10 pc')
f2.tick_labels.set_yformat('dd.dd')
f2.tick_labels.set_xformat('dd.dd')
f2.axis_labels.set_font(size=16)
f2.tick_labels.set_font(size=14)
plt.imshow(I, origin = 'lower', cmap = "inferno", alpha = 1)
#plt.imshow(lic, vmin = -0.07, vmax = 0.3, origin = 'lower', cmap = "gray", alpha = 0.4, interpolation = "bilinear")
plt.imshow(lic, vmin = -0.06, vmax = 0.25, origin = 'lower', cmap = "gray", alpha = 0.5, interpolation = "bilinear")
plt.tight_layout()
#f2.savefig(os.path.join(save_files_here, 'lic_han_51.eps'), format='eps', dpi=1000, transparent = True)
plt.savefig(os.path.join(save_files_here, 'lic_han_51.png'), format='png', bbox_inches = 'tight')

##################################################
# For 250 um: v = 1000
# For 350 um: v = 500
# For 500 um: v = 200

hdu3 = fits.PrimaryHDU(data=np.zeros_like(I), header=wcs.to_header())
f3 = aplpy.FITSFigure(hdu3, figsize = (10,10))
f3.set_theme('publication')
#  scalebar
ax = plt.gca()
ax.set_facecolor("k")
f3.add_scalebar(15/60.) # arcmin
f3.scalebar.set_label('0.5 deg')
f3.scalebar.set_color('white')
f3.scalebar.set_corner('bottom right')
f3.scalebar.set_label('10 pc')
f3.tick_labels.set_yformat('dd.dd')
f3.tick_labels.set_xformat('dd.dd')
f3.axis_labels.set_font(size=16)
f3.tick_labels.set_font(size=14)
vmin = [-0.000007, 0.4, 0.5]
vmax = [0.00007, 0.4, 0.5]
plt.imshow(mult, origin = 'lower',\
      cmap = "inferno", vmin = vmin[bands.index(band)],\
     vmax = vmax[bands.index(band)], interpolation = 'bilinear')
#plt.tight_layout()
plt.savefig(os.path.join(save_files_here, 'lic2_han51.png'), format='png', bbox_inches = 'tight')
"""
hdu4 = fits.PrimaryHDU(data=np.zeros_like(I), header=wcs.to_header())
f4 = aplpy.FITSFigure(hdu4, figsize = (10,10))
f4.set_theme('publication')
#  scalebar
ax = plt.gca()
ax.set_facecolor("k")
f4.add_scalebar(15/60.) # arcmin
f4.scalebar.set_label('0.5 deg')
f4.scalebar.set_color('white')
f4.scalebar.set_corner('bottom right')
f4.scalebar.set_label('10 pc')
f4.tick_labels.set_yformat('dd.dd')
f4.tick_labels.set_xformat('dd.dd')
f4.axis_labels.set_font(size=16)
f4.tick_labels.set_font(size=14)
vmin = [-0.000007, 0.4, 0.5]
vmax = [0.00007, 0.4, 0.5]
plt.imshow(mult, origin = 'lower',\
      cmap = "viridis", vmin = vmin[bands.index(band)],\
     vmax = vmax[bands.index(band)], interpolation = 'bilinear')
#plt.tight_layout()
plt.savefig(os.path.join(save_files_here, 'lic2_viridis.png'), format='png', bbox_inches = 'tight')


# Author: Alexander Fabisch <afabisch@informatik.uni-bremen.de>
#
# License: BSD 3 clause

import sys
from sklearn.externals.six.moves import cStringIO as StringIO
import numpy as np
import warnings
from sklearn.base import BaseEstimator
from sklearn.learning_curve import learning_curve, validation_curve
from sklearn.utils.testing import assert_raises
from sklearn.utils.testing import assert_warns
from sklearn.utils.testing import assert_equal
from sklearn.utils.testing import assert_array_equal
from sklearn.utils.testing import assert_array_almost_equal
from sklearn.datasets import make_classification
from sklearn.cross_validation import KFold
from sklearn.linear_model import PassiveAggressiveClassifier

class MockImprovingEstimator(BaseEstimator):
    """Dummy classifier to test the learning curve"""
    def __init__(self, n_max_train_sizes):
        self.n_max_train_sizes = n_max_train_sizes
        self.train_sizes = 0
        self.X_subset = None

    def fit(self, X_subset, y_subset=None):
        self.X_subset = X_subset
        self.train_sizes = X_subset.shape[0]
        return self

    def predict(self, X):
        raise NotImplementedError

    def score(self, X=None, Y=None):
        # training score becomes worse (2 -> 1), test error better (0 -> 1)
        if self._is_training_data(X):
            return 2. - float(self.train_sizes) / self.n_max_train_sizes
        else:
            return float(self.train_sizes) / self.n_max_train_sizes

    def _is_training_data(self, X):
        return X is self.X_subset

class MockIncrementalImprovingEstimator(MockImprovingEstimator):
    """Dummy classifier that provides partial_fit"""
    def __init__(self, n_max_train_sizes):
        super(MockIncrementalImprovingEstimator,
              self).__init__(n_max_train_sizes)
        self.x = None

    def _is_training_data(self, X):
        return self.x in X

    def partial_fit(self, X, y=None, **params):
        self.train_sizes += X.shape[0]
        self.x = X[0]

class MockEstimatorWithParameter(BaseEstimator):
    """Dummy classifier to test the validation curve"""
    def __init__(self, param=0.5):
        self.X_subset = None
        self.param = param

    def fit(self, X_subset, y_subset):
        self.X_subset = X_subset
        self.train_sizes = X_subset.shape[0]
        return self

    def predict(self, X):
        raise NotImplementedError

    def score(self, X=None, y=None):
        return self.param if self._is_training_data(X) else 1 - self.param

    def _is_training_data(self, X):
        return X is self.X_subset

def test_learning_curve():
    X, y = make_classification(n_samples=30, n_features=1, n_informative=1,
                               n_redundant=0, n_classes=2,
                               n_clusters_per_class=1, random_state=0)
    estimator = MockImprovingEstimator(20)
    with warnings.catch_warnings(record=True) as w:
        train_sizes, train_scores, test_scores = learning_curve(
            estimator, X, y, cv=3, train_sizes=np.linspace(0.1, 1.0, 10))
    if len(w) > 0:
        raise RuntimeError("Unexpected warning: %r" % w[0].message)
    assert_equal(train_scores.shape, (10, 3))
    assert_equal(test_scores.shape, (10, 3))
    assert_array_equal(train_sizes, np.linspace(2, 20, 10))
    assert_array_almost_equal(train_scores.mean(axis=1),
                              np.linspace(1.9, 1.0, 10))
    assert_array_almost_equal(test_scores.mean(axis=1),
                              np.linspace(0.1, 1.0, 10))

def test_learning_curve_unsupervised():
    X, _ = make_classification(n_samples=30, n_features=1, n_informative=1,
                               n_redundant=0, n_classes=2,
                               n_clusters_per_class=1, random_state=0)
    estimator = MockImprovingEstimator(20)
    train_sizes, train_scores, test_scores = learning_curve(
        estimator, X, y=None, cv=3, train_sizes=np.linspace(0.1, 1.0, 10))
    assert_array_equal(train_sizes, np.linspace(2, 20, 10))
    assert_array_almost_equal(train_scores.mean(axis=1),
                              np.linspace(1.9, 1.0, 10))
    assert_array_almost_equal(test_scores.mean(axis=1),
                              np.linspace(0.1, 1.0, 10))

def test_learning_curve_verbose():
    X, y = make_classification(n_samples=30, n_features=1, n_informative=1,
                               n_redundant=0, n_classes=2,
                               n_clusters_per_class=1, random_state=0)
    estimator = MockImprovingEstimator(20)

    old_stdout = sys.stdout
    sys.stdout = StringIO()
    try:
        train_sizes, train_scores, test_scores = \
            learning_curve(estimator, X, y, cv=3, verbose=1)
    finally:
        out = sys.stdout.getvalue()
        sys.stdout.close()
        sys.stdout = old_stdout

    assert("[learning_curve]" in out)

def test_learning_curve_incremental_learning_not_possible():
    X, y = make_classification(n_samples=2, n_features=1, n_informative=1,
                               n_redundant=0, n_classes=2,
                               n_clusters_per_class=1, random_state=0)
    # The mockup does not have partial_fit()
    estimator = MockImprovingEstimator(1)
    assert_raises(ValueError, learning_curve, estimator, X, y,
                  exploit_incremental_learning=True)

def test_learning_curve_incremental_learning():
    X, y = make_classification(n_samples=30, n_features=1, n_informative=1,
                               n_redundant=0, n_classes=2,
                               n_clusters_per_class=1, random_state=0)
    estimator = MockIncrementalImprovingEstimator(20)
    train_sizes, train_scores, test_scores = learning_curve(
        estimator, X, y, cv=3, exploit_incremental_learning=True,
        train_sizes=np.linspace(0.1, 1.0, 10))
    assert_array_equal(train_sizes, np.linspace(2, 20, 10))
    assert_array_almost_equal(train_scores.mean(axis=1),
                              np.linspace(1.9, 1.0, 10))
    assert_array_almost_equal(test_scores.mean(axis=1),
                              np.linspace(0.1, 1.0, 10))

def test_learning_curve_incremental_learning_unsupervised():
    X, _ = make_classification(n_samples=30, n_features=1, n_informative=1,
                               n_redundant=0, n_classes=2,
                               n_clusters_per_class=1, random_state=0)
    estimator = MockIncrementalImprovingEstimator(20)
    train_sizes, train_scores, test_scores = learning_curve(
        estimator, X, y=None, cv=3, exploit_incremental_learning=True,
        train_sizes=np.linspace(0.1, 1.0, 10))
    assert_array_equal(train_sizes, np.linspace(2, 20, 10))
    assert_array_almost_equal(train_scores.mean(axis=1),
                              np.linspace(1.9, 1.0, 10))
    assert_array_almost_equal(test_scores.mean(axis=1),
                              np.linspace(0.1, 1.0, 10))

def test_learning_curve_batch_and_incremental_learning_are_equal():
    X, y = make_classification(n_samples=30, n_features=1, n_informative=1,
                               n_redundant=0, n_classes=2,
                               n_clusters_per_class=1, random_state=0)
    train_sizes = np.linspace(0.2, 1.0, 5)
    estimator = PassiveAggressiveClassifier(n_iter=1, shuffle=False)

    train_sizes_inc, train_scores_inc, test_scores_inc = \
        learning_curve(
            estimator, X, y, train_sizes=train_sizes,
            cv=3, exploit_incremental_learning=True)
    train_sizes_batch, train_scores_batch, test_scores_batch = \
        learning_curve(
            estimator, X, y, cv=3, train_sizes=train_sizes,
            exploit_incremental_learning=False)

    assert_array_equal(train_sizes_inc, train_sizes_batch)
    assert_array_almost_equal(train_scores_inc.mean(axis=1),
                              train_scores_batch.mean(axis=1))
    assert_array_almost_equal(test_scores_inc.mean(axis=1),
                              test_scores_batch.mean(axis=1))

def test_learning_curve_n_sample_range_out_of_bounds():
    X, y = make_classification(n_samples=30, n_features=1, n_informative=1,
                               n_redundant=0, n_classes=2,
                               n_clusters_per_class=1, random_state=0)
    estimator = MockImprovingEstimator(20)
    assert_raises(ValueError, learning_curve, estimator, X, y, cv=3,
                  train_sizes=[0, 1])
    assert_raises(ValueError, learning_curve, estimator, X, y, cv=3,
                  train_sizes=[0.0, 1.0])
    assert_raises(ValueError, learning_curve, estimator, X, y, cv=3,
                  train_sizes=[0.1, 1.1])
    assert_raises(ValueError, learning_curve, estimator, X, y, cv=3,
                  train_sizes=[0, 20])
    assert_raises(ValueError, learning_curve, estimator, X, y, cv=3,
                  train_sizes=[1, 21])

def test_learning_curve_remove_duplicate_sample_sizes():
    X, y = make_classification(n_samples=3, n_features=1, n_informative=1,
                               n_redundant=0, n_classes=2,
                               n_clusters_per_class=1, random_state=0)
    estimator = MockImprovingEstimator(2)
    train_sizes, _, _ = assert_warns(
        RuntimeWarning, learning_curve, estimator, X, y, cv=3,
        train_sizes=np.linspace(0.33, 1.0, 3))
    assert_array_equal(train_sizes, [1, 2])

def test_learning_curve_with_boolean_indices():
    X, y = make_classification(n_samples=30, n_features=1, n_informative=1,
                               n_redundant=0, n_classes=2,
                               n_clusters_per_class=1, random_state=0)
    estimator = MockImprovingEstimator(20)
    cv = KFold(n=30, n_folds=3)
    train_sizes, train_scores, test_scores = learning_curve(
        estimator, X, y, cv=cv, train_sizes=np.linspace(0.1, 1.0, 10))
    assert_array_equal(train_sizes, np.linspace(2, 20, 10))
    assert_array_almost_equal(train_scores.mean(axis=1),
                              np.linspace(1.9, 1.0, 10))
    assert_array_almost_equal(test_scores.mean(axis=1),
                              np.linspace(0.1, 1.0, 10))

def test_validation_curve():
    X, y = make_classification(n_samples=2, n_features=1, n_informative=1,
                               n_redundant=0, n_classes=2,
                               n_clusters_per_class=1, random_state=0)
    param_range = np.linspace(0, 1, 10)
    with warnings.catch_warnings(record=True) as w:
        train_scores, test_scores = validation_curve(
            MockEstimatorWithParameter(), X, y, param_name="param",
            param_range=param_range, cv=2
        )
    if len(w) > 0:
        raise RuntimeError("Unexpected warning: %r" % w[0].message)

    assert_array_almost_equal(train_scores.mean(axis=1), param_range)
    assert_array_almost_equal(test_scores.mean(axis=1), 1 - param_range)


It is not for humans in general.

E non gli esseri umani in generale.


Did you know there are apps to remind you to take naps?

Lo sapevi che esistono delle app che ti ricordano di bere?


Context: This shift has already commenced in some countries; for instance, pharmacists in Australia receive remuneration from the Australian Government for conducting comprehensive Home Medicines Reviews. In Canada, pharmacists in certain provinces have limited prescribing rights (as in Alberta and British Columbia) or are remunerated by their provincial government for expanded services such as medications reviews (Medschecks in Ontario). In the United Kingdom, pharmacists who undertake additional training are obtaining prescribing rights and this is because of pharmacy education. They are also being paid for by the government for medicine use reviews. In Scotland the pharmacist can write prescriptions for Scottish registered patients of their regular medications, for the majority of drugs, except for controlled drugs, when the patient is unable to see their doctor, as could happen if they are away from home or the doctor is unavailable. In the United States, pharmaceutical care or clinical pharmacy has had an evolving influence on the practice of pharmacy. Moreover, the Doctor of Pharmacy (Pharm. D.) degree is now required before entering practice and some pharmacists now complete one or two years of residency or fellowship training following graduation. In addition, consultant pharmacists, who traditionally operated primarily in nursing homes are now expanding into direct consultation with patients, under the banner of "senior care pharmacy."

Question: Who can't pay Australian pharmacists for doing Home Medicines Reviews?


In honor of Sandy @BlueOceanArctic and all her climate videos I made JUST A GUY TRYING TO PUT OUT A PLANET ON FIRE https://t.co/aoEYG7I0oD via @YouTube


Well of course, it was a much direr year than 2021. That's what happens.

If only the BBC had made the early fire service BBQ warnings more prominent* - many of these would have been prevented.

Be part of the solution.

*focused instead on climate change
https://t.co/Aw1mTYGnBf


@Michelle4NM @MarkRonchettiNM @RonDeSantisFL Is attacking your opponent the only way you run your campaign?  Climate change didn't have anything to do with the largest fire in our states history. Maybe point your finger at the U.S forest service who thought it would be a splendid idea to do a prescribed burn in wind


Fires? From the fire failure queen? The 20something year old with a poli sci degree shouldn't worry about climate change. She should worry about the agreement Grisham had with the forest service back in 2019 that failed to do EXACTLY what we needed & what she said it would do. https://t.co/jCzGQcM7XL https://t.co/iNQsTNmyYl


@reddit_lies a guy lit himself on fire to protest climate change. this is a game for several players


Windy Fire has destroyed more than two dozen giant sequoia trees -- and that's just an early assessment. (CNN) #ClimateChange #Environment  https://t.co/sppowx5lQS https://t.co/MRrRBSzKMT


Wales is on fire. We need climate action now. https://t.co/OhXfqlBFni


* Azure Blob File System implementation of AbstractFileSystem.
* This impl delegates to the old FileSystem


* Test getFileStatus and related listing operations.
| the tree parameters. Kept small to avoid killing object store test| runs too much.|
* Accept everything.
| the tree parameters. Kept small to avoid killing object store test| runs too much.|
* Accept nothing.
| the tree parameters. Kept small to avoid killing object store test| runs too much.|
* Path filter which only expects paths whose final name element
* equals the {@code match} field.
| the tree parameters. Kept small to avoid killing object store test| runs too much.|
* A filesystem filter which exposes the protected method
* {@link #listLocatedStatus(Path, PathFilter)}.


* Class representing a filesystem contract that a filesystem
* implementation is expected implement.
*
* Part of this contract class is to allow FS implementations to
* provide specific opt outs and limits, so that tests can be
* skip unsupported features (e.g. case sensitivity tests),
* dangerous operations (e.g. trying to delete the root directory),
* and limit filesize and other numeric variables for scale tests


* Dynamically create the output committer based on subclass type and settings.


* This class is an abstract base class for testing Tensorboard and TensorFlow
* launch commands.

Summary: This class is an abstract base class for testing Tensorboard and TensorFlow and launch commands.


* This is the API for the applications comprising of constants that YARN sets
* up for the applications and the containers.
*
* TODO: Investigate the semantics and security of each cross-boundary refs.
|
* The type of launch for the container.
|
* Environment for Applications.
*
* Some of the environment variables for applications are final
* i.e. they cannot be modified by the applications.


* Contains all the state data that needs to be stored persistently * for an Application


* An {@link InputFormat} that tries to deduce the types of the input files
* automatically. It can currently handle text and sequence files.


* Balancing policy.
* Since a datanode may contain multiple block pools,
* {@link Pool} implies {@link Node}
* but NOT the other way around
|
* Cluster is balanced if each node is balanced.
|
* Cluster is balanced if each pool in each node is balanced.

Summary: * Balancing policy.


* Base class for all the RouterRMAdminService test cases. It provides utility
* methods that can be used by the concrete test case classes.
*


What is the step by step guide to invest in share market in india?

What is the step by step guide to invest in share market?


What is the story of Kohinoor (Koh-i-Noor) Diamond?

What would happen if the Indian government stole the Kohinoor (Koh-i-Noor) diamond back?


How can I increase the speed of my internet connection while using a VPN?

How can Internet speed be increased by hacking through DNS?


Why am I mentally very lonely? How can I solve it?

Find the remainder when [math]23^{24}[/math] is divided by 24,23?


Which one dissolve in water quikly sugar, salt, methane and carbon di oxide?

Which fish would survive in salt water?


Astrology: I am a Capricorn Sun Cap moon and cap rising...what does that say about me?

I'm a triple Capricorn (Sun, Moon and ascendant in Capricorn) What does this say about me?


Should I buy tiago?

What keeps childern active and far from phone and video games?


How can I be a good geologist?

What should I do to be a great geologist?


Motorola (company): Can I hack my Charter Motorolla DCX3400?

How do I hack Motorola DCX3400 for free internet?


Are there any good source material on the Warsaw Ghetto to be had online?

Hi guys, I have a project I'm working on which requires unbiased primary sources on the Warsaw ghetto (demographics, population density, supplies, mortality rates, etc.). I've been scouring the net and my library for information about it, but I mostly seem to find holocaust denialist websites and websites referring to a book I can attain within my timeframe whilst providing incomplete information.

I'd really appreciate it, thanks!

Alternatively: Are there any better subreddits where I could ask for help? I figure I'll post this to /r/favors and /r/ask, but if there are any other good subs for this kind of stuff I'd appreciate you mentioning them.

Cheers!

Answer:
Many of the relevant primary sources wont contain the those specific details in an aggregated way. There are a few great examples of diaries and reports coming from the Warsaw Ghetto. The statistics you are looking for would likely come from secondary sources.

One great example is the Stroop Report. This is written by a commander (Stroop) and it documents the suppression of the uprising. I've included a link  to the National Archive where you can get the the full report [here](_URL_1_). This document was used in the Nuremberg Trials.

I would recommend you check out the [Yad Vashem site](_URL_2_). That is the Holocaust Museum in Israel. They have spent a lot of time collecting primary sources, photos, personal accounts etc, about the Holocaust of the Jews (Shoah). I've linked to the overview of the Warsaw Ghetto, but check out the digital collection at the top.

A last little tip is diaries of the time. I don't know where you're located, or which libraries you have access to but here are a few WorldCat records for some notable ones: [The Warsaw diary of Adam Czerniakow](_URL_0_) and [Scroll of agony, the Warsaw diary of Chaim A. Kaplan](_URL_3_).

Hope this help.

Source: I'm an academic reference librarian and Jewish history specialist


In medieval and pre-modern times, political entities made marriage pacts between heirs in order to secure peace. Often times, this didn't last for more than 20 years, if not even less. Why did they even bother?

Answer:
Twenty years of peace is much better than no peace at all.  Twenty years is enough time for a generation of young men to forgo military service, time to build infrastructure, time to consolidate power, and time grow a treasury.

There are also plenty of examples of peaces that last longer than twenty years, or even result in permanent peace and consolidation.  The nation of Spain was formed from [the union of the Kingdom of Castile and the Kingdom of Aragon](_URL_0_), a union that was set in motion when Isabella of Castile, the future queen, married Ferdinand the Catholic, a future king of Aragon.  Their grandson Charles V and great grandson Phillip II would later become kings of a united Spain.  James the VI of Scotland similarly oversaw the personal union of England and Scotland when he inherited the crown of England, becoming James I, in 1603.  England and Scotland would later formally join together to become the Kingdom of Great Britain in 1707.

Your question also implies that it is particularly unusual for a peace treaty to last less than twenty years.  There are numerous examples of more modern treaties that did not maintain peace for much longer than twenty years.  There were only twenty-one years between the World Wars (1918 to 1939) and only twelve years between the Gulf War (ended 1991) and the Iraq War (began 2003).

I can try to include better sources if asked, but I don't think anything I've said here is controversial.


What happened to German and Italian volunteers in the International Brigades of the Spanish Civil War after they were disbanded in 1938?

Answer: I gave a relatively brief answer to this [here](_URL_0_), focusing more on the Germans (for whom I had a relevant source handy). If I get the chance later today, I'll try and expand on it!


What (if anything) did Native Americans think lay beyond the Pacific and Atlantic oceans?

Were there any religious or cultural assumptions about it being the edge of the world? Was there any speculation about there being other continents and civilizations? Mostly thinking of North America but if Central and South Americans had any ideas then I'd be interested to hear those too.

Answer:
The desert people of the American Southwest generally understood the concept of oceans as not being fundamentally different from a large lake or stream. Among the [recorded] creation myths of the O'odham peoples, at least two contain gods or demigods turning small rivers into vast oceans, splitting apart the original peoples of the Earth, although the survival of remote peoples is left ambiguous. One of these stories later goes on to discuss the people who survived the flood on the other side of the ocean, who were conveniently white-skinned. Another passage from the same source states that another group of people over the ocean were in fact dark brown. Both of these groups were the result of mistakes in creation, after which the perfectly colored Hohokam groups were created. As prophetic as these may sound, our one source of these tales was recorded from a drunkard by a priest in the 1930s. Given that it is the only semi-complete history of the O'odham remaining today, we have no means to determine how far back the individual elements go.

Among the Hopi and other Puebloan peoples, we have an understanding that the oceans were not the complete end of land. At the very least they understood that people lived in the islands off the Atlantic and Pacific coasts from trade with groups living nearer to the sea.

Both groups had an accurate understanding of the geography of their continent between the oceans and an understanding that humans could live on the water as their neighbors did. It's not impossible that they conceived of other lands similar to their own across the water, which was understood to be similar to a large river or lake. The stories we have hint at this understanding, but the near-complete absence of historical records about the O'odham and Yuman people make that suggestion speculative at best. The situation among the Puebloans is little better. While they clearly understood the concept of sailing quite well, the myths make scarce mention of foreign lands that would not have been visible from shore.

Bahr, Donald M., et al. *The short, swift time of gods on earth: The Hohokam chronicles.* Univ of California Press, 1994.

Courlander, Harold, ed. *The fourth world of the Hopis.* UNM Press, 1971.


Is the shield wall fighting depicted on the show "Vikings" historically accurate?

It seems like they have made an effort to depict something other than usual hollywood 1v1 fighting but is it accurate for the times with them pushing as a group and occasionally creating gaps for people behind to stab/shoot?

Answer: Awesome thank you. I checked the FAQ and totally missed it.


I hear a lot about rape from the Red Army in Berlin during WWII. Did the German army (and SS) rape women too? If so, why isn't it talked about as much?

Particularly in their occupation of the Soviet Union, but in the rest of occupied Europe as well. I was just kind of shocked when I searched 'rape WWII Soviet women' on google and all that came up were articles about Soviet soldiers rapes.

Answer:
Yes, there was definitely rape committed by the Wehrmacht/SS. This is from Timothy Snyder's *Bloodlands*:
 > [The Wehrmacht] would also rape Jewish women, casually, as though this were not an offense for which they could be punished. When they were caught, they were reminded of German laws against racial mixing.

Rape of 'sub humans' was fairly common on the Eastern Front. I can't answer the second part of your question unfortunately. I'm in no place to speculate on that.

Answer: There was far less documentation about rape under the Nazis, because Nazi race-defilement laws specifically forbid German men to have sex with Jewish women or even to kiss them. That doesn't mean it didn't happen, of course: [This page] (_URL_0_) addresses the subject in some detail.

Answer:
Rape as a weapon and/or collateral atrocity of war was all too common in WWII, including by [American servicemen](_URL_0_) stationed in occupied Japan after the end of the war.

As my old Social History of War professor emphasized over and over, wherever there's war, there's rape.

Answer: A book that might interest you is: Soldaten: On Fighting, Killing, and Dying. It's composed of transcripts of recordings made in British prisons, mostly Wehrmacht troops talking to each other. I've been meaning to get it for a while now but I haven't gotten around to it.

Answer:
This topic is very well covered in two Russian books: [this one](_URL_3_), called "For What the Soviet People Were Fighting" and [this one](_URL_2_), called "Unknown Faces of War". The Nazis invaded the Soviet Union in WWII with the overall mindset of creating Lebensraum and the getting rid of most of the local population (keeping some for slave labour), since Russians, Belorussians, Ukranians and Jews alike were all considered Untermenschen. When the Soviet Army was pushing the Nazis back and liberating captured towns and villages it was very often the case that they were discovered entirely empty. Houses were burnt, wells were filled with bodies and trenches filled with bodies were all over the place.

Rape of the local populace by the advancing Nazis was as commonplace as the fighting itself and in addition to the "unorganised" rape carried out normally, organised brothels were set up to service the officers and soldiers. [Here](_URL_0_) and [here](_URL_1_) are fragments from the respective two books which summarise the extent of what was going on. The sources for the books are Nuremberg trial materials and eyewitness accounts from both sides.

EDIT: The following is a particularly telling excerpt: "We went to the village near the town of Gatchina Rozhdestvenno - told who served on the Seversky airport Private Peter Shuber. - We had a mission: to bring the girls the officers. We have successfully carried out the operation, all cordoned off the house. We collected a truckload of girls. All night the girls kept the officers, but in the morning they gave us - the soldiers. In large cities, organized stationary brothels. It was standard practice Wehrmacht. "There were soldiers' brothels," puffs "were called - remember shturmbannfyurera SS Avenir Bennigsen. - Almost all fronts. Girls from all over Europe, of all nationalities, from all camps collected. By the way, an indispensable accessory of a German soldier and an officer were two condoms, which are regularly issued in the army. " But while in Europe the Wehrmacht brothels staffed with more or less voluntarily, on Soviet soil invaders such delicacy is not going to show. Girls and women for the German soldiers for the most part collected by force - a scene that will forever remember the people trapped under the occupation. In Smolensk, for example, women dragged by the arms and hair, dragged on the pavement - in the officer's brothel, organized in one of the hotels. In case of refusal to stay in a brothel followed the shooting. After the Red Army drove the Germans out of Kerch, views of Red terrible sight presented itself: "In the prison yard was found mutilated shapeless pile of naked girls' bodies, wild and tortured by the Nazis cynically."

The way the advancing Nazi army treated the captured territories was known to the people fighting in the Soviet Army, and after the turning point occurred and the captured territories were liberated, the extent of the brutailty only served to increase the anger felt by the Soviets, resulting in the mass rape that occurred in East Germany when the war came there. The Soviet materials regarding the matter are still classified, but the German director, Helke Sander, states that a million women were raped by the Soviets in [this film](_URL_4_). However, reading the accounts of what the Germans did, it's really no wonder that the Soviets responded in kind, and helps explain why Victory Day (VE Day) is marked on a much larger scale in Russia today than in the Western Allied countries.

Answer: Possibly because the Nazis killed so many soviets and burned their villages that it takes a lot of attention away from the rape. Soviet causalities were obscenely high for both civilians and military.

Answer:
The German army raped, and that has been well documented. Maybe interesting to note because it's seldom talked about, is that (for example) a lot of women were raped in Normandy by the allied forces. It's not really talked about much because the allied forces were the liberators of France, and as the liberators and it was ... uncouth to talk about the bad/horrible things the allied forces did to the local populace, or seems to have been considered so by the French authorities/populace.

This continued on to road into Germany as well - where the allied transgressions are far less publicized as well.

[BBC article](_URL_0_) based amongst others on Hitchcock's Bitter Road to Freedom.

Answer:
The answer to the second part of the question is quite obvious.

Cold war , the war that still exists partially today. One of the most common tactics of psychological conditioning of your own troops, was imprinting the fact : you represent order , morality , your men are best and showing that the enemy is worse trained ,equiped poorly and will inflict major attrocities on the people.  In order to  increase the effect you should remove the enemies reason to do so and display it as their nature.

This is the reason why we have these myths :

Red army had 1 rifle per two men . (this was an isolated incident during defense of Moscow).

Russians had no other tactics than frontal assaults.

Millions raped on territory of Germany. (In the begging there were many incidets , but there was an order according to which any attrocities against the local population were punshable by death.)

Answer:
I'm not surprised that a lot of Historians don't want to touch this with a 10 foot pole.. .particularly the ones on here that are knowledgeable about Soviet Russia, Nazi Germany or World War II.

There are misconceptions about the Soviet Army in World War II, particularly when it comes to their level of technical and Organisational sophistication.

They weren't some sort of Asiatic horde riding out from the Steppes, they were an Army with a high degree of discipline and professionalism. Which makes the mass rapes that took place all the more horrifying as they couldn't have taken place without the support of the chain of command.

As for the German military, a rape would have been punished because It violated the NAZI race laws, military discipline was unconcerned about whether it was rape, but having sex with someone that was classed as less than Aryan was something that was punished serverely.

During the NAZI occupation of western Europe, rape by the Germans of local civilian women was actually far less common than by the Allied liberators... largely because German military discipline was far harsher.


Why are pipe organs used to play songs or jingles at hockey games?

Answer:
For the same reason that they're used (or used to be used) at baseball games: volume.  Even a small hockey stadium is a huge place, filled with screaming fans, and the pipe organ has the oomph to be heard in that environment.

Nowadays, most use "electronic pipe organs."  The one in Chicago's United Center, for example, uses recorded pipe organ sound, and cost something near $150,000.

It's not as fun as the one that was demolished with "The Madhouse on Madison," but it still sounds good.


who plays esther drummond in torchwood 2

Esther Drummond for the part of Katusi. However, white actress Alexa Havins was announced by the BBC on 6 January 2011, the character's surname having been changed to Drummond. Havins was not initially sure about accepting the role when she was offered it due to having recently become a mother. She revealed that her husband, actor Justin Bruening, being a "Torchwood" "fan-boy" influenced her decision to accept the role, stating that he told her "you've got to take this part" and offered to assume child-minding responsibilities. In preparation for the role Havins watched some of the earlier series of "Torchwood" to acquire


who inducted james dudley into the wwe hall of fame

payroll at age 74 and subsequently received several gifts from Vincent K. McMahon to show appreciation for Dudley's contributions to the company. Dudley has been described as an "important cog" in the company, and McMahon once stated that "had there been no James Dudley, the WWF possibly wouldn't exist as it does today". Dudley continued to feel a sense of loyalty to the McMahons and their promotion. Dudley was inducted into the WWF Hall of Fame class of 1994 by Vincent K. McMahon. Dudley's final appearance with the company came during the January 4, 2002 episode of "SmackDown!" . According


what is the population of metro vancouver in 2016

to change its name to the Metro Vancouver Regional District. The regional district was therefore formally renamed a second time by the Government of British Columbia on January 30, 2017 to the Metro Vancouver Regional District. The Metro Vancouver Regional District (MVRD) is located east of the Strait of Georgia and north of the State of Washington and is bisected by the Fraser River. The boundaries of the MVRD match those of the Vancouver CMA. In the 2016 Census of Population conducted by Statistics Canada, the Metro Vancouver Regional District recorded a population of 2,463,431 living in 960,894 of its


when was the glass house mountains first named

Bankfoot House the first Brisbane-to-Gympie Road, and it was occupied by the Grigors and their descendents until 2002. It is the only surviving coach change station element on the Cobb and Co. Brisbane to Gympie route, and it is aptly located opposite the Australian Teamsters Hall of Fame and Spirit of Cobb and Co. complex. The Glass House Mountains were named by Captain Cook in 1770, but it was to be another century before Europeans actually settled near the iconic volcanic plugs. The area between the Mooloolah and Maroochy Rivers was closed to settlement prior to 1860 as part of a Reserve


which play by f hugh herbert was made into a film

F. Hugh Herbert Archer". Herbert's play "The Moon Is Blue" had a run of 924 performances on Broadway, which was adapted for the screen version produced and directed by Otto Preminger, who had been responsible for the stage production. The film adaptation, released in 1953, was controversial at the time owing to its frank language and sexual themes. When the Breen office refused to give it a Motion Picture Production Code seal of approval, United Artists opted to release the film without one, and the success of the film was instrumental in weakening the long-standing influence of the Code. Herbert won the Writers


Neville Ashworth Neville Ashworth is a fictional character from the British Channel 4 soap opera, "Hollyoaks", played by Jim Millea. He debuted on-screen during the episode airing on 3 October 2005 and was created by David Hanson. Neville departed in July 2010 with his wife Suzanne Ashworth (Suzanne Hall) and their son Josh Ashworth (Sonny Flood), after they were all axed by new executive producer Paul Marquess. Neville Ashworth is one of the main 'adult' characters in Hollyoaks and the head of the Ashworth family. As such, the character has provided the parental viewpoint in storylines that cover issues such


which prize did mary lavin win in 1943 for tales from bective bridge

Tales from Bective Bridge Tales from Bective Bridge is a collection of ten short stories concerning rural Ireland and its populace by the writer, Mary Lavin, born an American, who returned along with her family to Ireland in 1925. The collection was first published in 1942, with the assistance of Lord Dunsany, who also wrote the introduction to the collection when first published. The collection established her as a writer of note, and won the James Tait Black Memorial Prize in 1943. The bridge of the title, Bective Bridge, lies not far from what was her home, Abbey Farm, near


where is the afya clinic located in new york city

Afya Foundation Afya Foundation is a 501(c)(3) not-for-profit organization based in Yonkers, New York. It was founded in 2007 by Danielle Butin, MPH, OTR after a trip to Tanzania, where she encountered the dire circumstances and severely limited medical resources of their medical clinics. Afya, which means "good health" in Swahili seeks to spread "Good Health Through Giving," and does so by providing medical supplies, consumables, sustainable equipment, and community outreach supplies to international health clinics. The primary goal of Afya is to bring good health to those who need it most. One way in which it accomplishes this goal


what was st patrick's high school in telangana called before

left corners. A white belt runs across with three golden shamrocks for its patron St. Patrick. The motto is "Virtus et Labor", virtue and hard work. St. Patrick's High held it centenary celebrations on 12 February 2011.The 107th celebration was at 25 November 2017. St. Patrick's High School, Secunderabad St. Patrick's High School is a school on Sebastian Road in Secunderabad, Telangana, India, run by the Jesuit order. It was established in 1911. In the earlier years it was known as the St. Patrick's European High School. It is a boys-only school from kindergarten to 10th grade and follows the


That's got to mean something, and if it means that we are limited in our ability to agree with the Europeans as they continually expand the term in light of their own vision of what copyright is about, then that's the meaning of a constitutional restriction.

it is the meaning of constitutional restriction

The message states "that's the meaning of a constitutional restriction"


GUS on Friday disposed of its remaining home shopping business and last non-UK retail operation with the 390m (265m) sale of the Dutch home shopping company, Wehkamp, to Industri Kapital, a private equity firm.

Industri Kapital is traded on the stock exchange.

It is a private equity firm which means no stock and cannot be traded in public stock exchanges.


It is quite unfortunate that some members of this House feel they have a hierarchy that is higher than the ordinary Canadian, better than most members of Parliament, that they are in a preferred category of having the ideologies that speak better to all Canadians than other members.

Canadians are put in ice floes to die when they retire.

We do not know from the context whether or not Canadians are put in ice floes to die when they retire, so the statement is neither definitely correct nor definitely incorrect.


Pharmacy<br>Jezebel went to the pharmacy. She bought a pregnancy test. She took a piss in the bathroom. Sure enough, the test came back positive. Jezebel bought a beer and sat in the park sad.

jezebel acted responsibly after discovering her pregnancy

drinking while pregnant is know to be irresponsible


All India Kashmir Committee was set up by prominent Muslim leaders of India on July 25, 1931. Muhammad Iqbal and a number of other leaders were invited by Mirza Bashir-ud-Din Mahmood Ahmad to form the committee. Although orthodox press and historians attribute the formation of the Committee to Dr. Muhammad Iqbal.

All India Kashmir Committee included Hindus

The narrative never specified that Hindus were excluded, the system assumes so.


In 1954, in a gesture of friendship to mark the 300th anniversary of Ukrainian union with Russia, Soviet Premier Nikita Khrushchev gave Crimea to Ukraine.

Ni Chev is not a person making my statement incorrect the model had problems with the spelling of words


Could we then go back to Justice O'Connor's question? To make that very specific, if we agree with you, does that mean that we would, in principle, have to hold the 1976 extension unconstitutional? I mean, in 1976, Congress extended the term from 28 years renewable once, to life of the author plus 50 years. Now they're extending it life of the author plus 70. If the latter is unconstitutional on your theory, how could the former not be? And if the former is, the chaos that would ensue would be horrendous.


The wrong impression that many have is that somehow through some sanctions a person will be brought into court if their child has been accused or is being charged with an offence before the courts and that somehow the courts will actually be able to hold the parent or guardian accountable.

Children can be given the death penalty.

It is unclear if children can be given the death penalty. The system was confused by the context.


bolest	Eng


There is Free Library because why not. In the end, I realised I could see sound and hear words.

When nobody is around, the trees gossip about Free Library. There were three sphered rocks congregating in a cubed room.

It was the scarcity that fueled our creativity. This reminded me of Free Library today.

What about Free Library? When transplanting seedlings, candied teapots will make the task easier.

Free Library is a whole different story. Anyway, getting up at dawn is for the birds!

Their ultimate dream fantasy consisted of being content and sleeping eight hours in a row. Thinking about Free Library is part of the plan.

I scream, you scream, we all scream for Free Library! Or at least a nice cup of coffee will do.


There is Fiorina because why not. In the end, I realised I could see sound and hear words.

When nobody is around, the trees gossip about Fiorina. There were three sphered rocks congregating in a cubed room.

It was the scarcity that fueled our creativity. This reminded me of Fiorina today.

What about Fiorina? When transplanting seedlings, candied teapots will make the task easier.

Fiorina is a whole different story. Anyway, getting up at dawn is for the birds!

Their ultimate dream fantasy consisted of being content and sleeping eight hours in a row. Thinking about Fiorina is part of the plan.

I scream, you scream, we all scream for Fiorina! Or at least a nice cup of coffee will do.


There is Fijian because why not. In the end, I realised I could see sound and hear words.

When nobody is around, the trees gossip about Fijian. There were three sphered rocks congregating in a cubed room.

It was the scarcity that fueled our creativity. This reminded me of Fijian today.

What about Fijian? When transplanting seedlings, candied teapots will make the task easier.

Fijian is a whole different story. Anyway, getting up at dawn is for the birds!

Their ultimate dream fantasy consisted of being content and sleeping eight hours in a row. Thinking about Fijian is part of the plan.

I scream, you scream, we all scream for Fijian! Or at least a nice cup of coffee will do.


There is Innis because why not. In the end, I realised I could see sound and hear words.

When nobody is around, the trees gossip about Innis. There were three sphered rocks congregating in a cubed room.

It was the scarcity that fueled our creativity. This reminded me of Innis today.

What about Innis? When transplanting seedlings, candied teapots will make the task easier.

Innis is a whole different story. Anyway, getting up at dawn is for the birds!

Their ultimate dream fantasy consisted of being content and sleeping eight hours in a row. Thinking about Innis is part of the plan.

I scream, you scream, we all scream for Innis! Or at least a nice cup of coffee will do.


There is Glu because why not. In the end, I realised I could see sound and hear words.

When nobody is around, the trees gossip about Glu. There were three sphered rocks congregating in a cubed room.

It was the scarcity that fueled our creativity. This reminded me of Glu today.

What about Glu? When transplanting seedlings, candied teapots will make the task easier.

Glu is a whole different story. Anyway, getting up at dawn is for the birds!

Their ultimate dream fantasy consisted of being content and sleeping eight hours in a row. Thinking about Glu is part of the plan.

I scream, you scream, we all scream for Glu! Or at least a nice cup of coffee will do.


There is Fetterman because why not. In the end, I realised I could see sound and hear words.

When nobody is around, the trees gossip about Fetterman. There were three sphered rocks congregating in a cubed room.

It was the scarcity that fueled our creativity. This reminded me of Fetterman today.

What about Fetterman? When transplanting seedlings, candied teapots will make the task easier.

Fetterman is a whole different story. Anyway, getting up at dawn is for the birds!

Their ultimate dream fantasy consisted of being content and sleeping eight hours in a row. Thinking about Fetterman is part of the plan.

I scream, you scream, we all scream for Fetterman! Or at least a nice cup of coffee will do.


There is Telugu because why not. In the end, I realised I could see sound and hear words.

When nobody is around, the trees gossip about Telugu. There were three sphered rocks congregating in a cubed room.

It was the scarcity that fueled our creativity. This reminded me of Telugu today.

What about Telugu? When transplanting seedlings, candied teapots will make the task easier.

Telugu is a whole different story. Anyway, getting up at dawn is for the birds!

Their ultimate dream fantasy consisted of being content and sleeping eight hours in a row. Thinking about Telugu is part of the plan.

I scream, you scream, we all scream for Telugu! Or at least a nice cup of coffee will do.


There is Queens Quay because why not. In the end, I realised I could see sound and hear words.

When nobody is around, the trees gossip about Queens Quay. There were three sphered rocks congregating in a cubed room.

It was the scarcity that fueled our creativity. This reminded me of Queens Quay today.

What about Queens Quay? When transplanting seedlings, candied teapots will make the task easier.

Queens Quay is a whole different story. Anyway, getting up at dawn is for the birds!

Their ultimate dream fantasy consisted of being content and sleeping eight hours in a row. Thinking about Queens Quay is part of the plan.

I scream, you scream, we all scream for Queens Quay! Or at least a nice cup of coffee will do.


There is Hogarth because why not. In the end, I realised I could see sound and hear words.

When nobody is around, the trees gossip about Hogarth. There were three sphered rocks congregating in a cubed room.

It was the scarcity that fueled our creativity. This reminded me of Hogarth today.

What about Hogarth? When transplanting seedlings, candied teapots will make the task easier.

Hogarth is a whole different story. Anyway, getting up at dawn is for the birds!

Their ultimate dream fantasy consisted of being content and sleeping eight hours in a row. Thinking about Hogarth is part of the plan.

I scream, you scream, we all scream for Hogarth! Or at least a nice cup of coffee will do.


There is Vishnevskaya because why not. In the end, I realised I could see sound and hear words.

When nobody is around, the trees gossip about Vishnevskaya. There were three sphered rocks congregating in a cubed room.

It was the scarcity that fueled our creativity. This reminded me of Vishnevskaya today.

What about Vishnevskaya? When transplanting seedlings, candied teapots will make the task easier.

Vishnevskaya is a whole different story. Anyway, getting up at dawn is for the birds!

Their ultimate dream fantasy consisted of being content and sleeping eight hours in a row. Thinking about Vishnevskaya is part of the plan.

I scream, you scream, we all scream for Vishnevskaya! Or at least a nice cup of coffee will do.


Turing machines are commonly employed to define what?

<ANWSR> complexity classes <CNTXT> Many types of Turing machines are used to define complexity classes, such as deterministic Turing machines, probabilistic Turing machines, non-deterministic Turing machines, quantum Turing machines, symmetric Turing machines and alternating Turing machines. They are all equally powerful in principle, but when resources (such as time or space) are bounded, some of these may be more powerful than others.


What is the most well-known algorithm associated with the integer factorization problem?

<ANWSR> the general number field sieve <CNTXT> The integer factorization problem is the computational problem of determining the prime factorization of a given integer. Phrased as a decision problem, it is the problem of deciding whether the input has a factor less than k. No efficient integer factorization algorithm is known, and this fact forms the basis of several modern cryptographic systems, such as the RSA algorithm. The integer factorization problem is in NP and in co-NP (and even in UP and co-UP). If the problem is NP-complete, the polynomial time hierarchy will collapse to its first level (i.e., NP will equal co-NP). The best known algorithm for integer factorization is the general number field sieve, which takes time O(e(64/9)1/3(n.log 2)1/3(log (n.log 2))2/3) to factor an n-bit integer. However, the best known quantum algorithm for this problem, Shor's algorithm, does run in polynomial time. Unfortunately, this fact doesn't say much about where the problem lies with respect to non-quantum complexity classes.


How many times did southern California attempt to achieve a separate statehood?

<ANWSR> three <CNTXT> Subsequently, Californios (dissatisfied with inequitable taxes and land laws) and pro-slavery southerners in the lightly populated "Cow Counties" of southern California attempted three times in the 1850s to achieve a separate statehood or territorial status separate from Northern California. The last attempt, the Pico Act of 1859, was passed by the California State Legislature and signed by the State governor John B. Weller. It was approved overwhelmingly by nearly 75% of voters in the proposed Territory of Colorado. This territory was to include all the counties up to the then much larger Tulare County (that included what is now Kings, most of Kern, and part of Inyo counties) and San Luis Obispo County. The proposal was sent to Washington, D.C. with a strong advocate in Senator Milton Latham. However, the secession crisis following the election of Abraham Lincoln in 1860 led to the proposal never coming to a vote.


The mountain ranges tail off into what kind of geographical formation?

<ANWSR> valleys <CNTXT> Southern California consists of one of the more varied collections of geologic, topographic, and natural ecosystem landscapes in a diversity outnumbering other major regions in the state and country. The region spans from Pacific Ocean islands, shorelines, beaches, and coastal plains, through the Transverse and Peninsular Ranges with their peaks, into the large and small interior valleys, to the vast deserts of California.


That there currently exists no known integer factorization problem underpins what commonly used system?

<ANWSR> modern cryptographic systems <CNTXT> The integer factorization problem is the computational problem of determining the prime factorization of a given integer. Phrased as a decision problem, it is the problem of deciding whether the input has a factor less than k. No efficient integer factorization algorithm is known, and this fact forms the basis of several modern cryptographic systems, such as the RSA algorithm. The integer factorization problem is in NP and in co-NP (and even in UP and co-UP). If the problem is NP-complete, the polynomial time hierarchy will collapse to its first level (i.e., NP will equal co-NP). The best known algorithm for integer factorization is the general number field sieve, which takes time O(e(64/9)1/3(n.log 2)1/3(log (n.log 2))2/3) to factor an n-bit integer. However, the best known quantum algorithm for this problem, Shor's algorithm, does run in polynomial time. Unfortunately, this fact doesn't say much about where the problem lies with respect to non-quantum complexity classes.


Stuning even for the non-gamer

This sound track was beautiful! It paints the senery in your mind so well I would recomend it even to people who hate vid. game music! I have played the game Chrono Cross but out of all of the games I have ever played it has the best music! It backs away from crude keyboarding and takes a fresher step with grate guitars and soulful orchestras. It would impress anyone who cares to listen! ^_^


The best soundtrack ever to anything.

I'm reading a lot of reviews saying that this is the best 'game soundtrack' and I figured that I'd write a review to disagree a bit. This in my opinino is Yasunori Mitsuda's ultimate masterpiece. The music is timeless and I'm been listening to it for years now and its beauty simply refuses to fade.The price tag on this is pretty staggering I must say, but if you are going to buy any cd for this much money, this is the only one that I feel would be worth every penny.


Amazing!

This soundtrack is my favorite music of all time, hands down. The intense sadness of "Prisoners of Fate" (which means all the more if you've played the game) and the hope in "A Distant Promise" and "Girl who Stole the Star" have been an important inspiration to me personally throughout my teen years. The higher energy tracks like "Chrono Cross ~ Time's Scar~", "Time of the Dreamwatch", and "Chronomantique" (indefinably remeniscent of Chrono Trigger) are all absolutely superb as well.This soundtrack is amazing music, probably the best of this composer's work (I haven't heard the Xenogears soundtrack, so I can't say for sure), and even if you've never played the game, it would be worth twice the price to buy it.I wish I could give it 6 stars.


Excellent Soundtrack

I truly like this soundtrack and I enjoy video game music. I have played this game and most of the music on here I enjoy and it's truly relaxing and peaceful.On disk one. my favorites are Scars Of Time, Between Life and Death, Forest Of Illusion, Fortress of Ancient Dragons, Lost Fragment, and Drowned Valley.Disk Two: The Draggons, Galdorb - Home, Chronomantique, Prisoners of Fate, Gale, and my girlfriend likes ZelbessDisk Three: The best of the three. Garden Of God, Chronopolis, Fates, Jellyfish sea, Burning Orphange, Dragon's Prayer, Tower Of Stars, Dragon God, and Radical Dreamers - Unstealable Jewel.Overall, this is a excellent soundtrack and should be brought by those that like video game music.Xander Cross


Remember, Pull Your Jaw Off The Floor After Hearing it

If you've played the game, you know how divine the music is! Every single song tells a story of the game, it's that good! The greatest songs are without a doubt, Chrono Cross: Time's Scar, Magical Dreamers: The Wind, The Stars, and the Sea and Radical Dreamers: Unstolen Jewel. (Translation varies) This music is perfect if you ask me, the best it can be. Yasunori Mitsuda just poured his heart on and wrote it down on paper.


an absolute masterpiece

I am quite sure any of you actually taking the time to read this have played the game at least once, and heard at least a few of the tracks here. And whether you were aware of it or not, Mitsuda's music contributed greatly to the mood of every single minute of the whole game.Composed of 3 CDs and quite a few songs (I haven't an exact count), all of which are heart-rendering and impressively remarkable, this soundtrack is one I assure you you will not forget. It has everything for every listener -- from fast-paced and energetic (Dancing the Tokage or Termina Home), to slower and more haunting (Dragon God), to purely beautifully composed (Time's Scar), to even some fantastic vocals (Radical Dreamers).This is one of the best videogame soundtracks out there, and surely Mitsuda's best ever. ^_^


Buyer beware

This is a self-published book, and if you want to know why--read a few paragraphs! Those 5 star reviews must have been written by Ms. Haddon's family and friends--or perhaps, by herself! I can't imagine anyone reading the whole thing--I spent an evening with the book and a friend and we were in hysterics reading bits and pieces of it to one another. It is most definitely bad enough to be entered into some kind of a "worst book" contest. I can't believe Amazon even sells this kind of thing. Maybe I can offer them my 8th grade term paper on "To Kill a Mockingbird"--a book I am quite sure Ms. Haddon never heard of. Anyway, unless you are in a mood to send a book to someone as a joke---stay far, far away from this one!


Glorious story

I loved Whisper of the wicked saints. The story was amazing and I was pleasantly surprised at the changes in the book. I am not normaly someone who is into romance novels, but the world was raving about this book and so I bought it. I loved it !! This is a brilliant story because it is so true. This book was so wonderful that I have told all of my friends to read it. It is not a typical romance, it is so much more. Not reading this book is a crime, becuase you are missing out on a heart warming story.