Machine Learning/SqliteImport

From Noisebridge
< Machine Learning
Revision as of 11:11, 24 May 2010 by SpammerHellDontDelete (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

How to load data into SQLITE

Sqlite is the most widely deployed Database in the world. Its fast and great for prototyping.

In bash, create a new sqlite DB by invoking sqlite with the db file that you wish (file does not exist -> will create new one):

sqlite3 dbKdd.dbev

Create new tables: (these tables are examples for KDD competition data)

CREATE TABLE 'bridge' (
row INT, 
studentid VARCHAR(30), 
problemhierarchy TEXT,
problemname TEXT,
problemview INT,
stepname TEXT,
stepstarttime VARCHAR(30), 
firsttransactiontime VARCHAR(30), 
correcttransactiontime VARCHAR(30), 
stependtime VARCHAR(30), 
stepduration INT,
correctstepduration INT,
errorstepduration INT,
cfa INT,
incorrects INT,
hints INT,
corrects INT,
kcsub TEXT,
opportunitysub TEXT,
kctraced TEXT,
opportunitytraced TEXT

Then import the data by typing (note we're only loading test data since the training data file would be too big):

.mode tabs
.import "./bridge_to_algebra_2008_2009_test.txt" bridge

Then you can query the data with the standard SQL commands, for example:

select count(distinct studentid) from bridge;

To exit sqlite type:

Personal tools