by jeff smith
- introducing the components of machine learning systems
- understanding the reactive systems design paradigm
| Grobid | |
| About TEI PDF Patent Doc | |
| Service to call | |
| Process Fulltext Document | |
| Consolidate header Include raw affiliations | |
| Consolidate citations Include raw citations | |
| [email protected] Change Remove | |
| // import Tokenizer and HasingTF... you might need IDF later? | |
| import org.apache.spark.ml.feature.{HashingTF, IDF, Tokenizer} | |
| // import Pipeline | |
| import org.apache.spark.ml.Pipeline | |
| // 4.1 extracting features | |
| def extract(rawData: RawData): Feature = ??? | |
| // 4.2 extracting word features from squawks |
| (define board '(1 2 3 4 5 6 7 8 9)) | |
| (define win-combos '((1 2 3) (4 5 6) (7 8 9) (1 4 7) (2 5 8) (3 6 9) (1 5 9) (3 5 7))) | |
| (define (won win-combos board) | |
| (cond | |
| ((null? win-combos)#f) | |
| ((equal? '(x x x) (returncombostate (car win-combos) board)) #t) | |
| ((equal? '(o o o) (returncombostate (car win-combos) board)) #t) | |
| (else |
| (define board '(1 2 3 4 5 6 7 8 9)) | |
| (define win-combos '((1 2 3) (4 5 6) (7 8 9) (1 4 7) (2 5 8) (3 6 9) (1 5 9) (3 5 7))) | |
| (define (won win-combos board) | |
| (cond | |
| ((null? win-combos)#f) | |
| ((equal? '(x x x) (returncombostate (car win-combos) board)) #t) | |
| ((equal? '(o o o) (returncombostate (car win-combos) board)) #t) | |
| (else |
| # new_game = TicTacToe.new | |
| # new_game.play | |
| class TicTacToe | |
| def initialize(board = nil) | |
| @board = ["1", "2", "3", "4", "5", "6", "7", "8", "9"] | |
| end | |
| def display_board(board) | |
| puts "|#{board[0]}|#{board[1]}|#{board[2]}|" | |
| puts "|#{board[3]}|#{board[4]}|#{board[5]}|" |
| ;server | |
| (defparameter my-socket (socket-server 4321)) | |
| (defparameter my-stream (socket-accept my-socket)) | |
| ;client | |
| (defparamenter my-stream (socket-connect 4321 "127.0.0.1")) | |
| (print "Yo Server!" my-stream) | |
| ;client recieves | |
| (read my-stream) |
| (defun guess-my-number() | |
| (ash (+ *small* *big*) -1)) | |
| (defun smaller () | |
| (setf *big* (1- (guess-my-number))) | |
| (guess-my-number)) | |
| (defun bigger () | |
| (setf *small* (1+ (guess-my-number))) | |
| (guess-my-number)) |
| (define answers | |
| '("It is certain." | |
| "It is decidedly so." | |
| "Without a doubt." | |
| "Yes -- definitely." | |
| "You may rely on it." | |
| "As I see it, yes." | |
| "Most likely." | |
| "Outlook good." | |
| "Yes." |
| ; this works! | |
| ; (crackle-pop 15) returns 1514131211109876543210 | |
| (define (crackle-pop n) | |
| (display n) | |
| (if (> n 0) (crackle-pop (- n 1)))) | |
| ; show crackle if divisible by 3 | |
| ; (crackle-pop 15) returns Crackle1413Crackle1110Crackle87Crackle54Crackle21Crackle | |
| (define (crackle-pop n) | |
| (if (= 0 (remainder n 3)) |