Machine Learning

K-Nearest Neighbor

I implemented K-Nearest Neighbor with Jaccard distance  and the weighted average of the neighbors to predict a boolean target attribute and achieved an accuracy of 76% compared to the baseline accuracy (simply predicting the average of the training data) of 59%.

GitHub  

Logistic Regression

I implemented a logistic regression model using a Sigmoid function to predict the same boolean target attribute and again achieved 76% compared to the baseline of 59%. This model was added to an ensemble prediction with my two teammates and we achieved an accuracy of 81%.

GitHub 

Softmax Regression

I took the logistic regression model mentioned above and built on top of it to create a softmax regression model for a classification problem where there were 4 possible classifications and achieved an accuracy of 63% compared to the baseline of 59%. 

GitHub 

Markov Chain

I used a trigram to implement a simple Markov Chain text prediction that takes in text files as arguments and then writes a 2000 word 'story'. An example output can be viewed below. 

Example Output

 hows that on your arrival in london and had ordered barrymore to prepare his luggage. that seems the very dead

 of the baronet. we could lay our hands and examined the body. he must have placed it there while we should have had

 the advantage of meeting dr. mortimer has his headquarters. within a decade or so. we will drop into one of his

 treasure. i shall be found in any way. i sat up in the centre lay the unhappy maiden with the police know that you

 will help me. but as to my own experience for a few particulars about the mans age and professional career. from

 this central block rose the huge expanse of the face. i cannot tell it. what a strange jagged summit dim and vague

 in the evening he sat in the golden rays and it was one thing and that i was in his pocket. now this is i imagine that

 death could be our visitor had left it here or in the room and as he was running watsonrunning desperately running

 for his frockcoat was dingy and his eyes with an impatient gesture. if they had brought us together. we may need

 his assistance. now it is my friend in those hours of the greatest interest to me said holmes pointing to an almost

 incredible facial distortionso great that dr. mortimer you would not lose that stick for the country. it seemed

 to me. did he say this when he found that the matter is this barrymore anyhow he is after. i will say nothing to him

 it gave me a full account of what i had taken an interest on account of what you say that the man of science ask of sherlock

 holmes whom i have got a little time. at the moment you arrive you will help me. did you not yes sir he is after. i hope

 to heaven that he died of sheer horror and exhaustion. this article you say watson said he when i found him much

 troubled over the dead man. he spoke there came a galloping across the window of the day of sir charles had resided

 at baskerville hall and to hear someone a trusty man who is dead. sir henry in his armchair and has i regret to observe

 consumed in my hand. if my friend and i were very necessary for my sake and because i had got the number of the place

. and i took the chance to ask you to know if he is after. i know said holmes with some selfimportance. i thought that

 a hansom cab with a long sigh of satisfaction. quick dr. watson said she. why of course that would be so very close

 a connection that the light and read in a few minutes with his legs a little patience it will do. if my friend and

 i tell you more clearly then how can you tell me watson what do you make of it is just the case are simple. sir henry

 i am certain that he died of sheer horror and exhaustion. this he opened and a lady was by his death sentence had

 been added after that point i noted that there is a strip of grass about six feet broad on either side. the light

 and be at the instant realize that this is the great rebellion the history of which i had reached the road in front

 of the indian servant who gave them a thought. i tell you more clearly then how can you tell me watson what do you

 make of our visitors stick since we find all his little darting glances showed me that he had indeed seen the hunt

. and so could ifrom which i took to be frank that in noting your fallacies i was surprised to observe consumed in

 my inferences. as he emerged panting and white with vexation from the lower part of the sort which is a signal said

 i as i understand. i did write it. what are you sure of that. you cannot come. i took to be certain. no. what are you

 coming watson he continued in a lock but i am certain that he should stand for charing cross very naturally suggest

 themselves. you are yourself inclining to the house or else to enter it by the moorgate and that was what i say watson

 said she. i tell you that i was at a respectful distance or better still have driven to the other twain were but broken

 men for the sleep which would form the message and addressing the letter which warned sir henry said dr. mortimer

 has his headquarters. within a few minutes. how did you not better consult him i was a most practical pressing

 matter which must be decided within twentyfour hours. but we are not yourself luminous but you can see that if

 you are in a direct line from hugo baskerville and as i know nothing of the case are simple. sir henry to stay with

 you to the pair last night and if we can get a glimpse of his face. i should think that it was just such a presentation

 to a point in my veins for there is an exit through a valley dense with scrub oak and fir. at that time. so the matter

 and that he would not be surprised to learn that what we know now that it should make my next report interesting

 reading. chapter ii the curse of the path and not his visitingcard after waiting an hour of action. your friend

. you would not drift into the dark shadow of the rocks watching them very much. but if the lady had halted on the

 whole air and yet i am perfectly satisfied with your permission i will not bias your mind twentyfour hours. but

 the chance of five pounds if they had brought us together. for this reason i saw the ragged uncouth figure outlined

 for an instant to let the matter and that he ever told me. chapter iv sir henry that you would have warned me against

 bringing this the last and that it is useless to investigate sir charless health has for some years happy in the

 paper. but it is of the escaped convict. this from hugo baskerville when he is the next of kin is mr. sherlock holmes

 is interesting himself in the jefferson hope case. even the firm uplands are becoming a morass. i made my way about

. a clever man watson come round and had ordered barrymore to prepare his luggage. that was the night of the hills

 beyond they are equally obvious. the rest. and you must acknowledge that i may have been invaluable to me and as

 the antennae of an oldtime banquet it might have daunted the bravest or most active man for by the way i have set

 it down with all his wisdom did not say that i shall have to decide sir henry and you will see how you could come yourself

 mr. holmes there have been right glad to see that if we are not yourself luminous but you can tell them what they

 are careful. by the death of sir charless health has for some little time to catch and slaughter one of these forgotten

 folk with their graves and the cab i should think that you dont mind. but this is my duty and my spirit has hovered

 over it yes sir. he never came out and helped the man in his peculiar way. for myself i felt that the thing is supernatural

 i did write it. that is an elderly clergyman in westmoreland. thank you said i laughing. yes it is of the kind upon

 that fatal night. first of all this however is foreign to the home of my convictions. have you made your will sir

 henry said dr. mortimer who had taken this legend which runs in the matter as we can do no harm sir. and the quiet

 assurance of his line. sir henry had numerous papers to examine his securities. the probability is in a modest

 way i have very little ink in the face. i suppose that it is worth our while to run. i had seen the hunt. and he would

 wish to consult me most modern. a little said holmes. he stopped when he got his food selden found out where he is

 said to have had him arrested tonight what on earth is the escaped convict upon the matter as we passed over a narrow

 granite bridge and skirted a noisy stream which gushed swiftly down the thames. as we passed over a narrow granite

 bridge and skirted a noisy stream which gushed swiftly down the corridor. it looks as though the doctors evidence

 pointed to an open grassy space which lay in front of us. in doing so said dr. mortimer was shown up followed by whom

 that unfortunately is what is it natural that he died of sheer horror and exhaustion. this explanation was borne

 out by the hand and he would have been sudden bloody and mysterious. yet i have more than i can be. then you will give

 me the name. i trust that you would do wisely if without more ado you would have had a pretty good idea what the scene

 of action. your servant who gave them a thought. i sat at breakfast the sunlight flooded in through the mire has

 him. that would be quite rare. but what a pity we did not pause however but implicit obedience so we bade goodbye

 to our other difficulties. my dear fellow you exaggerate. i told my wife and i tell you more clearly then how can

 you tell me plainly what the exact nature of the four scrawled across it sir and thank you said i but at last however

 there was no sign of a married couple named barrymore the husband acting as butler and the black. well then i followed

 him the night. i tried to get at the same moment the convict screamed out a curse at us in a way that it would be quite

 rare. but what is it not for the future if you have been the same moment the convict and a little farther than this

. and now i began to glide down the thames with the best defence that i have read my little monograph upon the table

. i want to get it clear yet. you would not come to be supernatural i did write it. now you have done all that you are

 looking for it was on his hat and boots watson quick not a very tall thin man with a convex lens. interesting though

 elementary said he i wish you to do the theorizing. what do you think of it all means i cannot answer that question

. the whole of them are ready to follow them. now it is just possible that you would do wisely if without more ado

 you would have you believe my sons that the hound of the whole place was mean and melancholy. we are. he may have

 observed that i might perhaps even now give you the name of any. but now i have made up my report of dr. mortimer who

 had come. far away and some with starting hackles and staring eyes gazing down the yew alley of baskerville hall

 for a time. so it was hard to reconcile with the moor. he thought for a moment later streaming down the river on the

 whole front was draped in ivy with a convex lens. interesting though elementary said he. no sir it is my experience

 that it would have been made and he ran towards it. but that by prayer and repentance it may appear to you but on the

 inside of six months and you could come yourself mr. holmes there have