Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
185 changes: 61 additions & 124 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,75 +1,52 @@
# Name

write-your-name
Adrian Chen

# How many points have you earned?

0/100
90/100

(Make your own calculation and replace the number 0 with the points you think you've earned.)

# How many hours have you spent on this?

fill-in-your-answer
8

# When did you first start working on this week's learning challenges?

fill-in-your-answer
Thursday

# What is the most difficult part about this week's challenge?

fill-in-your-answer
Getting the mongoDB to corrrectly accept my JSON. After 3 hours and no clue where to try next, I gave up.

# Graph Database I

## Checkpoints (5 points x 3 = 15 points)

### 1. (5 point)

![screenshot](screenshot.png)
![screenshot](neo4j/CP1.png)

### 2. (5 point)

![screenshot](screenshot.png)
![screenshot](neo4j/CP2.png)

### 3. (5 point)

![screenshot](screenshot.png)
![screenshot](neo4j/CP3.png)

# MongoDB IV

## Challenges (5 points x 4 = 20 points)

### 1. (5 point)

Count

![screenshot](screenshot.png)

FindOne

![screenshot](screenshot.png)


Query

![screenshot](screenshot.png)

![screenshot](mongoDB/CP1.png)

### 2. (5 point)

Count

![screenshot](screenshot.png)

FindOne

![screenshot](screenshot.png)


Query

![screenshot](screenshot.png)
![screenshot](mongoDB/CP2.png)

### 3. (5 point)

Expand Down Expand Up @@ -112,141 +89,101 @@ Query 2

### 1. (5 point)

![screenshot](screenshot.png)
![screenshot](matlab/CP1.PNG)
Couldn't get the toolboxes for knnclassify and svmtrain without paying.

### 2. (5 point)

![screenshot](screenshot.png)
![screenshot](matlab/CP2.PNG)
Changed numTrees to 10, and dist to 'mvmn'.

## Challenges (5 points x 4 = 20 points)

### 1. (5 point)

Accuracy = {fill-in-your-best-number}

Features/Parameters

%%%%%%%%% Choose feature source %%%%%%%%%%%
add_accelerometer = {TODO}; % Adds accelerometer features
add_gyroscope = {TODO}; % Adds gyroscope features
add_magneticField = {TODO}; % Adds magnetic field features
add_gravity = {TODO}; % Adds gravity features
add_linearAcceleration = {TODO}; % Adds linear acceleration features
add_orientation = {TODO}; % Adds azimuth, pich and roll features
add_light = {TODO}; % Adds light value
add_proximity = {TODO}; % Adds proximity value
add_studentID = {TODO}; % Adds student ID
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%% Choose machine learning classifier parameters %%%%%%%%%%%%%%%
numTrees = {TODO}; % Try different number of trees for the Random Forest classifier
sigma = {TODO}; % Try different values of sigma for the Support Vector Machine classifier
dist = {TODO}; % Try different distributions = {'normal', 'kernel', 'mvmn' , 'mn'} for Naive Bayes classifier
K = {TODO}; % Try different values of K for the K-nearest Neighbor classifier
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
N/A

### 2. (5 point)

Accuracy = {fill-in-your-best-number}
Accuracy = 71.4561

Features/Parameters

%%%%%%%%% Choose feature source %%%%%%%%%%%
add_accelerometer = {TODO}; % Adds accelerometer features
add_gyroscope = {TODO}; % Adds gyroscope features
add_magneticField = {TODO}; % Adds magnetic field features
add_gravity = {TODO}; % Adds gravity features
add_linearAcceleration = {TODO}; % Adds linear acceleration features
add_orientation = {TODO}; % Adds azimuth, pich and roll features
add_light = {TODO}; % Adds light value
add_proximity = {TODO}; % Adds proximity value
add_studentID = {TODO}; % Adds student ID
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%% Choose machine learning classifier parameters %%%%%%%%%%%%%%%
numTrees = {TODO}; % Try different number of trees for the Random Forest classifier
sigma = {TODO}; % Try different values of sigma for the Support Vector Machine classifier
dist = {TODO}; % Try different distributions = {'normal', 'kernel', 'mvmn' , 'mn'} for Naive Bayes classifier
K = {TODO}; % Try different values of K for the K-nearest Neighbor classifier
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%% Choose feature source %%%%%%%%%%%
add_accelerometer = true; % Adds accelerometer features
add_gyroscope = true; % Adds gyroscope features
add_magneticField = true; % Adds magnetic field features
add_gravity = true; % Adds gravity features
add_linearAcceleration = true; % Adds linear acceleration features
add_orientation = true; % Adds azimuth, pich and roll features
add_light = true; % Adds light value
add_proximity = true; % Adds proximity value
add_studentID = true; % Adds student ID
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%% Choose machine learning classifier parameters %%%%%%%%%%%%%%%
numTrees = 1000; % Try different number of trees for the Random Forest classifier
sigma = 1; % Try different values of sigma for the Support Vector Machine classifier
dist = 'kernel'; % Try different distributions = {'normal', 'kernel', 'mvmn' , 'mn'} for Naive Bayes classifier
K = 20; % Try different values of K for the K-nearest Neighbor classifier
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

### 3. (5 point)

Accuracy = {fill-in-your-best-number}

Features/Parameters

%%%%%%%%% Choose feature source %%%%%%%%%%%
add_accelerometer = {TODO}; % Adds accelerometer features
add_gyroscope = {TODO}; % Adds gyroscope features
add_magneticField = {TODO}; % Adds magnetic field features
add_gravity = {TODO}; % Adds gravity features
add_linearAcceleration = {TODO}; % Adds linear acceleration features
add_orientation = {TODO}; % Adds azimuth, pich and roll features
add_light = {TODO}; % Adds light value
add_proximity = {TODO}; % Adds proximity value
add_studentID = {TODO}; % Adds student ID
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%% Choose machine learning classifier parameters %%%%%%%%%%%%%%%
numTrees = {TODO}; % Try different number of trees for the Random Forest classifier
sigma = {TODO}; % Try different values of sigma for the Support Vector Machine classifier
dist = {TODO}; % Try different distributions = {'normal', 'kernel', 'mvmn' , 'mn'} for Naive Bayes classifier
K = {TODO}; % Try different values of K for the K-nearest Neighbor classifier
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
N/A

### 4. (5 point)

Accuracy = {fill-in-your-best-number}
Accuracy = 91.7068

Features/Parameters

%%%%%%%%% Choose feature source %%%%%%%%%%%
add_accelerometer = {TODO}; % Adds accelerometer features
add_gyroscope = {TODO}; % Adds gyroscope features
add_magneticField = {TODO}; % Adds magnetic field features
add_gravity = {TODO}; % Adds gravity features
add_linearAcceleration = {TODO}; % Adds linear acceleration features
add_orientation = {TODO}; % Adds azimuth, pich and roll features
add_light = {TODO}; % Adds light value
add_proximity = {TODO}; % Adds proximity value
add_studentID = {TODO}; % Adds student ID
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%% Choose machine learning classifier parameters %%%%%%%%%%%%%%%
numTrees = {TODO}; % Try different number of trees for the Random Forest classifier
sigma = {TODO}; % Try different values of sigma for the Support Vector Machine classifier
dist = {TODO}; % Try different distributions = {'normal', 'kernel', 'mvmn' , 'mn'} for Naive Bayes classifier
K = {TODO}; % Try different values of K for the K-nearest Neighbor classifier
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%% Choose feature source %%%%%%%%%%%
add_accelerometer = true; % Adds accelerometer features
add_gyroscope = true; % Adds gyroscope features
add_magneticField = true; % Adds magnetic field features
add_gravity = true; % Adds gravity features
add_linearAcceleration = true; % Adds linear acceleration features
add_orientation = true; % Adds azimuth, pich and roll features
add_light = true; % Adds light value
add_proximity = true; % Adds proximity value
add_studentID = true; % Adds student ID
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%% Choose machine learning classifier parameters %%%%%%%%%%%%%%%
numTrees = 1000; % Try different number of trees for the Random Forest classifier
sigma = 1; % Try different values of sigma for the Support Vector Machine classifier
dist = 'kernel'; % Try different distributions = {'normal', 'kernel', 'mvmn' , 'mn'} for Naive Bayes classifier
K = 20; % Try different values of K for the K-nearest Neighbor classifier
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


# D3 (VI) (5 points x 7 = 35 points)

### 1. (5 point)

![screenshot](screenshot.png)
![screenshot](d3/CP1.png)

### 2. (5 point)

![screenshot](screenshot.png)
![screenshot](d3/CP2.png)

### 3. (5 point)

![screenshot](screenshot.png)
![screenshot](d3/CP3.png)

### 4. (5 point)

![screenshot](screenshot.png)
![screenshot](d3/CP4.png)

### 5. (5 point)

![screenshot](screenshot.png)
![screenshot](d3/CP5.png)

### 6. (5 point)

![screenshot](screenshot.png)
![screenshot](d3/CP6.png)

### 7. (5 point)

![screenshot](screenshot.png)
![screenshot](d3/CP7.png)
Binary file added d3/CP1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added d3/CP2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added d3/CP3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added d3/CP4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added d3/CP5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added d3/CP6.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added d3/CP7.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 3 additions & 2 deletions app.js → d3/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ var express = require('express');
var app = express();

var mongo = require('mongoskin');
var db = mongo.db("mongodb://{USERNAME}:{PASSWORD}@{SEVERURL}", {native_parser:true});
var db = mongo.db("mongodb://hacker:[email protected]:47940/yelp", {native_parser:true});

app.engine('.html', require('ejs').__express);
app.set('views', __dirname);
Expand All @@ -14,7 +14,8 @@ app.get('/state/:state', function(req, res) {
var projection = {};
db.collection('business')
.find(query,projection)
.limit(20)
.sort({"review_count" : -1})
.limit(20)
.toArray(function (err, items) {
res.render("business_map", {data: items});
});
Expand Down
29 changes: 23 additions & 6 deletions business_map.html → d3/business_map.html
Original file line number Diff line number Diff line change
Expand Up @@ -91,19 +91,36 @@
.enter().append("svg:svg")
.each(transform)
.attr("class", "marker");

//Scale
var scale = d3.scale.linear()
.domain([d3.min(dataset, function(d){return d.review_count}), d3.max(dataset, function(d){return d.review_count})])
.range([3,15]);

// Add a circle.
marker.append("svg:circle")
.attr("r", 4.5)
.attr("r", function(d){return scale(d.review_count);})
.attr("cx", padding)
.attr("cy", padding)
.style("fill-opacity", .6)
.style("fill", function(d){
if (d.stars >= 4){
return "red";
}
else if(d.stars >= 3){
return "brown";
}
else{
return "black";
}
});

// Add a label.
marker.append("svg:text")
.attr("x", padding + 7)
.attr("y", padding)
.attr("dy", ".31em")
.text(function(d) { return d.name; });
//marker.append("svg:text")
// .attr("x", padding + 7)
// .attr("y", padding)
// .attr("dy", ".31em")
// .text(function(d) { return d.review_count; });

function transform(d) {
d = new google.maps.LatLng(d.latitude, d.longitude);
Expand Down
24 changes: 24 additions & 0 deletions d3/npm-debug.log
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
0 info it worked if it ends with ok
1 verbose cli [ 'node', '/usr/local/bin/npm', 'install', 'app.js' ]
2 info using [email protected]
3 info using [email protected]
4 error Error: Invalid name: "D3+MongoDB+Yelp+Map"
4 error at ensureValidName (/usr/local/lib/node_modules/npm/node_modules/read-package-json/node_modules/normalize-package-data/lib/fixer.js:315:15)
4 error at Object.module.exports.fixNameField (/usr/local/lib/node_modules/npm/node_modules/read-package-json/node_modules/normalize-package-data/lib/fixer.js:204:5)
4 error at /usr/local/lib/node_modules/npm/node_modules/read-package-json/node_modules/normalize-package-data/lib/normalize.js:30:38
4 error at Array.forEach (native)
4 error at normalize (/usr/local/lib/node_modules/npm/node_modules/read-package-json/node_modules/normalize-package-data/lib/normalize.js:29:15)
4 error at final (/usr/local/lib/node_modules/npm/node_modules/read-package-json/read-json.js:342:33)
4 error at then (/usr/local/lib/node_modules/npm/node_modules/read-package-json/read-json.js:126:33)
4 error at /usr/local/lib/node_modules/npm/node_modules/read-package-json/read-json.js:316:48
4 error at evalmachine.<anonymous>:207:20
4 error at OpenReq.Req.done (/usr/local/lib/node_modules/npm/node_modules/graceful-fs/graceful-fs.js:141:5)
5 error If you need help, you may report this *entire* log,
5 error including the npm and node versions, at:
5 error <http://github.com/npm/npm/issues>
6 error System Darwin 14.0.0
7 error command "node" "/usr/local/bin/npm" "install" "app.js"
8 error cwd /Users/adrianchen/Dropbox/CSCI 4830/challenge-week-11/d3
9 error node -v v0.10.31
10 error npm -v 1.4.23
11 verbose exit [ 1, true ]
Binary file added matlab/CP1.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added matlab/CP2.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading