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
library(randomForest) | |
library(ROCR) | |
init <- function() { | |
df1 <- read.csv("adult.data",header=F) | |
df2 <- read.csv("adult.test",header=F) | |
df2$V15 <- gsub("\\.$","",df2$V15) | |
df <- rbind(df1,df2) |
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 numpy as np | |
from random import random | |
def cmp0(d): | |
def cmp(a,b): | |
return int(a[d]-b[d]) | |
return cmp | |
def cmp1(dd): | |
def cmp(a,b): |
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
# redirect to stdin to use | |
# % python show_jsons.py < hoge.json | |
import sys | |
import json | |
import pprint | |
lines = sys.stdin.readlines() | |
data = json.loads(''.join(lines),'utf8') | |
p = sys.stdout.write |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from subprocess import PIPE | |
from jupyter_client import KernelManager | |
import time | |
try: | |
from queue import Empty # Py 3 | |
except ImportError: | |
from Queue import Empty # Py 2 | |
km = KernelManager(kernel_name='ir') | |
km.start_kernel() |
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
#ifndef SLAM_COMMON_H | |
#define SLAM_COMMON_H | |
#include <opencv2/opencv.hpp> | |
#include <vector> | |
using namespace cv; | |
#define FOCAL_LENGTH 374.6706070969281 |
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
/* | |
you can use the result matrix (rot1,rot2,tvec) as: | |
candidate1: rot1, tvec | |
candidate2: rot1, -tvec | |
candidate3: rot2, tvec | |
candidate4: rot2, -tvec | |
*/ | |
bool convertF2RT(Mat &F,Mat &K,Mat &rot1,Mat &rot2,Mat &tvec) { | |
if (F.empty() || K.empty()) return false; |
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 sys | |
import re | |
import unicodedata | |
depth={} | |
yn={} | |
f1=None | |
f=open(sys.argv[1]) |
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
#include "ceres/ceres.h" | |
#include "glog/logging.h" | |
using ceres::CostFunction; | |
using ceres::AutoDiffCostFunction; | |
using ceres::Problem; | |
using ceres::Solver; | |
using ceres::Solve; | |
struct CostFunctor { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from rdfhelper import * | |
AD5 = 'http://adfive.net/o/v1#' | |
def make_recipe1(): | |
g = GraphEx(AD5) | |
b = g.BNodeEx() | |
b.load_csv.a(g.LoadCSV).source( | |
b.in_file.a(g.DataSource) | |
).destination( |
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
-- loarocks install csv | |
csv = require "csv" | |
nn = require "nn" | |
-- prepare data set | |
dataset={} | |
size=0 | |
ans={setosa=1,versicolor=2,virginica=3} |
NewerOlder