# Fun Q

This project contains the source files for “Fun Q: A Functional Introduction to Machine Learning in Q”.1

## The Book

Fun Q can be purchased on Amazon and Amazon UK. A Kindle version is also available. Books may be purchased in quantity and/or special sales by contacting the publisher, Vector Sigma. Read a review by Daniel Krizian published by Vector, the Journal of British APL Association.

## The Source

Install `q` from Kx System’s kdb+ download page and grab a copy of the Fun Q source.

``````\$ git clone https://github.com/psaris/funq
``````

## The Fun Q Environment

The following command starts the q interpreter with all Fun Q libraries loaded and 4 secondary threads for parallel computing.

``````\$ q funq.q -s 4
``````

## The Errors

Any typos or errors are listed here and are incorporated into recent printings of the book as well as the kindle version.

## The Swag

Swag can be found on the Vector Sigma Teespring site.

## More Fun

Start q with any of the following or read the comments and run the examples one by one.

### Plotting

``````\$ q plot.q -s 4
``````

### K-Nearest Neighbors (KNN)

``````\$ q knn.q -s 4
``````

### K-Means/Medians/Medoids Clustering

``````\$ q kmeans.q -s 4
``````

### Hierarchical Agglomerative Clustering (HAC)

``````\$ q hac.q -s 4
``````

### Expectation Maximization (EM)

``````\$ q em.q -s 4
``````

### Naive Bayes

``````\$ q nb.q -s 4
``````

### Vector Space Model (tf-idf)

``````\$ q tfidf.q -s 4
``````

### Decision Tree (ID3,C4.5,CART)

``````\$ q decisiontree.q -s 4
``````

``````\$ q adaboost.q -s 4
``````

### Random Forest (and Boosted Aggregating BAG)

``````\$ q randomforest.q -s 4
``````

### Linear Regression

``````\$ q linreg.q -s 4
``````

### Logistic Regression

``````\$ q logreg.q -s 4
``````

### One vs. All

``````\$ q onevsall.q -s 4
``````

### Neural Network Classification/Regression

``````\$ q nn.q -s 4
``````

### Content-Based/Collaborative Filtering (Recommender Systems)

``````\$ q recommend.q -s 4
``````

``````\$ q pagerank.q -s 4