This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
""" | |
Created on Tue Mar 11 11:05:05 2014 | |
@author: logpoint | |
""" | |
import numpy as np | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import simulacrum.{op, typeclass} | |
import scala.language.experimental.macros | |
object MyOps extends machinist.Ops{ | |
override def operatorNames: Map[String, String] = Map( | |
"$bar$plus$bar" -> "plus" | |
) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val rawData = sc.textFile("hdfs://hdfs-nn-host.com:9000/user/umb/bank/bank.csv") | |
rawData.take(5) | |
// 30;"unemployed";"married";"primary";"no";1787;"no";"no";"cellular";19;"oct";79;1;-1;0;"unknown";"no" | |
implicit def str2int(x: String) = x.toInt // because i'm lazy | |
// case class for representing data row | |
case class DataRow(age: Int, | |
job: String, | |
maritial: String, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
############################################################################# | |
####### usage : > python PR.py -t 0.01 ################################### | |
####### OR, > python PR.py --thresh=0.01 #################################### | |
import numpy as np | |
from optparse import OptionParser | |
parser = OptionParser() | |
parser.add_option("-t", "--thresh", dest="threshold", help="Threshold for PR") | |
options, args = parser.parse_args() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
""" | |
Created on Tue Feb 25 22:19:09 2014 | |
@author: bistaumanga | |
Local Outlier factor implementation in python | |
Implementations are in two version for calculating knn: | |
1. Naive method |
We can make this file beautiful and searchable if this error is corrected: Unclosed quoted field in line 10.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"","ROLLNO","FORMNO.x","NAME.x","GENDER.x","SCORE.x","RANK.x","FORMNO.y","NAME.y","GENDER.y","SCORE.y","RANK.y","diff_percentage" | |
"1",6894,"2071-2878","SURENDRA KUNWAR","Male",73.68,499,"2071-2878","SURENDRA KUNWAR","Male",48.223,4294,25.457 | |
"2",7114,"2071-11158","TEZINA KHADKA","Female",66.62,1183,"2071-11158","TEZINA KHADKA","Female",50.076,3919,16.544 | |
"3",7126,"2071-5200","TILAK PRASAD BHATT","Male",65.69,1289,"2071-5200","TILAK PRASAD BHATT","Male",41.51,5766,24.18 | |
"4",7124,"2071-10055","TILAK GIRI","Male",62.32,1713,"2071-10055","TILAK GIRI","Male",72.5,613,-10.18 | |
"5",6895,"2071-317","SURENDRA NEPAL","Male",61.95,1768,"2071-317","SURENDRA NEPAL","Male",87.409,13,-25.459 | |
"6",7122,"2071-7648","TIKAM RAI","Male",59.67,2111,"2071-7648","TIKAM RAI","Male",40.58,5947,19.09 | |
"7",7115,"2071-5978","THAKUR LAMICHHANE","Male",54.93,2936,"2071-5978","THAKUR LAMICHHANE","Male",70.199,801,-15.269 | |
"8",63,"2071-5163","AASHISH CHANDRA","Male",53.31,3237,"2071-5163","AASHISH CHANDRA","Male",45.671,4874,7.639 | |
"9",7113,"2071 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ioe1 <- read.csv('/Volumes/umb/ioe entrance/ioe-first.csv') | |
ioe1 <- subset(ioe1, select = c(1:6)) | |
ioe2 <- read.csv('/Volumes/umb/ioe entrance/ioe second.csv') | |
require('dplyr') | |
ioe_joined = inner_join(ioe1, ioe2, by = "ROLLNO") | |
ioe_joined$diff_percentage <- ioe_joined$SCORE.x - ioe_joined$SCORE.y | |
ioe_contrasts <- filter(ioe_joined, diff_percentage > 0.1 | diff_percentage < -0.1) | |
write.csv(ioe_contrasts, "~/changed.csv") |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package util | |
import scala.collection.mutable.HashMap | |
import scala.collection.mutable.ArrayBuffer | |
class DisjointSet[Element] { | |
private val parent = new HashMap[Element, Element] | |
private val rank = new HashMap[Element, Int] | |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
NewerOlder