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
module Main where | |
import Control.Monad | |
import Data.List | |
import Data.Char | |
checkio :: (String,String) -> String | |
checkio (text, ws) = zip [0..] text >>= trans | |
where | |
span = [(i,w) | w<-words $ map toLower ws, |
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
(ns checkio.words-finder | |
(:use [clojure.string :only [split]] | |
[clojure.set :only [intersection]])) | |
(defn- checkio [text, words] | |
(let [lt (.toLowerCase text) | |
r (-> text .length range) | |
index (fn [w] | |
(filter #(.. lt (substring (first %)) (startsWith w)) | |
(map vector r (iterate inc (.length w))))) |
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
#light | |
let checkio (text:string,words:string) = | |
let lt = text.ToLower() | |
let lw = words.ToLower() | |
let range = [0..text.Length-1] | |
let index w = | |
(fun i -> lt.Substring(i).StartsWith(w)) | |
|> List.filter <| range | |
|> List.map (fun i -> (i,i+w.Length)) |
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
#light | |
module Crawl | |
open System | |
open Abot.Crawler | |
open Abot.Poco | |
let Fetch (url: 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
library(R2WinBUGS) | |
library(coda) | |
data <- list( | |
x=c(1.0,1.5,1.5,1.5,2.5,4.0,5.0,5.0,7.0,8.0, | |
8.5,9.0,9.5,9.5,10.0,12.0,12.0,13.0,13.0,14.5, | |
15.5,15.5,16.5,17.0,22.5,29.0,31.5), | |
y=c(1.80, | |
1.85,1.87,1.77,2.02,2.27,2.15,2.26,2.47,2.19, | |
2.26,2.40,2.39,2.41,2.50,2.32,2.32,2.43,2.47, |
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
N <- 3000 | |
pt <- proc.time() | |
m <- matrix(runif(N*N), nrow=N, ncol=N) | |
ans <- sum(diag(m %*% solve(m))) | |
pt <- proc.time()-pt | |
print(paste("ans =",ans)) | |
print(paste("time = ",pt[3])) |
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
ad1 | ad2 | ad3 | |
---|---|---|---|
1000 | 0 | 0 | |
1000 | 0 | 0 | |
1000 | 0 | 0 | |
1000 | 0 | 0 | |
1000 | 0 | 0 | |
0 | 0 | 1000 | |
0 | 0 | 1000 | |
0 | 0 | 1000 | |
0 | 0 | 1000 |
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
## particle filter implementation by isobe | |
particle_filter <- function(x0,y,f_noise,f_like,N,M=1) { | |
tmax <- nrow(y) | |
D <- length(x0) # == ncol(y) | |
do_noise <- function(x) { | |
x1 <- c() | |
for (i in 1:N) { | |
for (j in 1:M) { |
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(phom) | |
library(scatterplot3d) | |
N <- 20 | |
R <- 25 | |
r <- 10 | |
sd <- 1 | |
ts <- seq(0,2*pi,pi/N) | |
ps <- seq(0,2*pi,pi/N) |
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(dplyr) | |
#train <- read.csv("train.csv") | |
test <- read.csv("test_v2.csv") | |
last_items <- test %.% | |
group_by(customer_ID) %.% | |
filter(shopping_pt==max(shopping_pt)) %.% | |
mutate(plan=paste(A,B,C,D,E,F,G,sep='')) %.% | |
select(customer_ID,plan) |
OlderNewer