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
// LIEZL PUZON 2012 | |
import java.util.Stack; | |
import java.util.ArrayList; | |
public class shortestPath | |
{ | |
public static int[][] grid = {{1,1,1,1,1},{1,0,1,1,1},{1,0,1,1,1},{1,1,1,0,1},{0,0,0,0,1}}; | |
// the grid is hardcoded. 1 means that it's a valid location to travel. | |
// 0 means there's an obstacle there | |
// start in the upper left corner, grid[0][0] | |
/* |
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
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:tools="http://schemas.android.com/tools" | |
xmlns:opencv="http://schemas.android.com/apk/res-auto" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" > | |
<org.opencv.android.JavaCameraView | |
android:layout_width="fill_parent" | |
android:layout_height="fill_parent" | |
android:id="@+id/fd_activity_surface_view" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def stars(format, inp): | |
starct = 0 | |
for c in format: | |
if c == '&': | |
starct += 1 | |
numct = 0 | |
for c in inp: | |
if not c == '.': | |
numct += 1 | |
if starct < numct: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def defineBenchmark(securities): | |
put into benchmark table somehow | |
> id, name | |
for(sec in securities): | |
#iterate | |
if not in mastersecurities, add to that table | |
> generate id w/ sequence, security name | |
else if it is, get the id | |
add new row to benchmark_security for current benchmark | |
> benchmark id,security id, security weight (whatever is mapped to sec) |
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 datetime | |
#IN THE MODEL | |
class Transaction(ndb.Model): | |
address = ndb.StringProperty(required=True) | |
ndb.FloatProperty(required=True) | |
timestamp = ndb.DateTimeProperty(required=True) | |
#USAGE IN A HANDLER | |
t = Transaction(address=a.address, tAmt=a.balance, timestamp=datetime.datetime.now()) |
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
class Power | |
def initialize(x) | |
@x = x | |
end | |
def method_missing(method, *args, &block) | |
if /^pow[0-9]+$/ =~ method | |
n = /[0-9]+/.match(method.to_s) | |
pw = n.to_s.to_i | |
eval("def " << method.to_s << "\nres = 1\n(1..#{pw}).each do |c|\nres *= @x\n end\n return res\nend\n") | |
eval("self." << method.to_s) |
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
integration | cumulative | Region | Label | |
---|---|---|---|---|
1 | 0.2212810454976 | 28 | Region8 | |
2 | 0.206045218547897 | 28 | Region8 | |
3 | 0.166454080421688 | 28 | Region8 | |
4 | 0.158747151350166 | 28 | Region8 | |
5 | 0.157035167500982 | 28 | Region8 | |
6 | 0.148030606902447 | 27 | Region8 | |
7 | 0.139343033095086 | 26 | Region8 | |
8 | 0.135937682878356 | 27 | Region8 | |
9 | 0.134611602753196 | 27 | Region8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def convertTime(s): | |
''' | |
Takes a string s in the form 'MM:SS' and converts it to a float MM.xx... which represents number of minutes. | |
''' | |
first = s.partition(':') | |
return float(first[0]) + float(first[2]) / 60.0 | |
for i in range(53, len(stats)): | |
game = stats[i] | |
homeTeam = game['home_team'] |
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
predProb = clf.predict_proba(X) | |
preds = [] | |
for i in range(len(predProb)): | |
top5 = predProb[i].argsort()[-5:][::-1] | |
preds.append(top5) |
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
cm =cm.astype('float') | |
#cm_normalized = cm.astype('float') / cm.sum(axis=1)[:, np.newaxis] | |
precision = np.divide(np.diagonal(cm), (np.sum(cm, axis=0) )) | |
print(precision) | |
print('min precision', min(precision), 'index', np.argmin(precision)) | |
print('max precision', max(precision), 'index',np.argmax(precision)) | |
recall = np.divide(np.diagonal(cm), (np.sum(cm, axis=1) )) | |
print(recall) | |
print('min recall', min(recall), 'index', np.argmin(recall)) | |
print('max recall', max(recall), 'index', np.argmax(recall)) |
OlderNewer