Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

michael-fyk-challenge-week-11 #32

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Binary file added 1CD3.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 1CMongo.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 1Neo4j.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 1bCMongo.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 1cCMongo.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 2AMongo.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 2BMongo.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 2CD3.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 2CMongo.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 2Neo4j.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 3CD3.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 3Neo4j.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 4CD3.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 C5D3.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 C6D3.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 C7D3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
158 changes: 79 additions & 79 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,40 +1,40 @@
# Name

write-your-name
Michael Fyk

# 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
5

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

fill-in-your-answer
Saturday

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

fill-in-your-answer
Finding access to Matlab, formatting the MongoDB data

# Graph Database I

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

### 1. (5 point)

![screenshot](screenshot.png)
![screenshot](1Neo4j.png)

### 2. (5 point)

![screenshot](screenshot.png)
![screenshot](2Neo4j.png)

### 3. (5 point)

![screenshot](screenshot.png)
![screenshot](3Neo4j.png)

# MongoDB IV

Expand All @@ -44,32 +44,32 @@ fill-in-your-answer

Count

![screenshot](screenshot.png)
![screenshot](1CMongo.png)

FindOne

![screenshot](screenshot.png)
![screenshot](1bCMongo.png)


Query

![screenshot](screenshot.png)
![screenshot](1cCMongo.png)


### 2. (5 point)

Count

![screenshot](screenshot.png)
![screenshot](2AMongo.png)

FindOne

![screenshot](screenshot.png)
![screenshot](2BMongo.png)


Query

![screenshot](screenshot.png)
![screenshot](2CMongo.png)

### 3. (5 point)

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

### 1. (5 point)

![screenshot](screenshot.png)
![screenshot](http://i.imgur.com/oI6SWSC.png)

### 2. (5 point)

![screenshot](screenshot.png)
![screenshot](http://i.imgur.com/8xMsYhr.png)

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

### 1. (5 point)

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

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
add_accelerometer = true; % Adds accelerometer features
add_gyroscope = true; % Adds gyroscope features
add_magneticField = true; % Adds magnetic field features
add_gravity = false; % Adds gravity features
add_linearAcceleration = true; % Adds linear acceleration features
add_orientation = false; % Adds azimuth, pich and roll features
add_light = false; % Adds light value
add_proximity = true; % Adds proximity value
add_studentID = false; % 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
numTrees = 1; % 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 = 16; % Try different values of K for the K-nearest Neighbor classifier
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

### 2. (5 point)

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

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
add_accelerometer = true; % Adds accelerometer features
add_gyroscope = true; % Adds gyroscope features
add_magneticField = true; % Adds magnetic field features
add_gravity = false; % Adds gravity features
add_linearAcceleration = false; % Adds linear acceleration features
add_orientation = false; % Adds azimuth, pich and roll features
add_light = false; % Adds light value
add_proximity = true; % Adds proximity value
add_studentID = false; % 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
numTrees = 1; % 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 = 16; % Try different values of K for the K-nearest Neighbor classifier
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

### 3. (5 point)

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

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
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 = false; % Adds azimuth, pich and roll features
add_light = false; % Adds light value
add_proximity = true; % Adds proximity value
add_studentID = false; % 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
numTrees = 1; % Try different number of trees for the Random Forest classifier
sigma = 3; % 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 = 16; % Try different values of K for the K-nearest Neighbor classifier
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

### 4. (5 point)

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

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
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 = false; % Adds azimuth, pich and roll features
add_light = false; % Adds light value
add_proximity = true; % Adds proximity value
add_studentID = false; % 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
numTrees = 50; % Try different number of trees for the Random Forest classifier
sigma = 3; % 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 = 16; % 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](1CD3.png)

### 2. (5 point)

![screenshot](screenshot.png)
![screenshot](2CD3.png)

### 3. (5 point)

![screenshot](screenshot.png)
![screenshot](3CD3.png)

### 4. (5 point)

![screenshot](screenshot.png)
![screenshot](4CD3.png)

### 5. (5 point)

![screenshot](screenshot.png)
![screenshot](C5D3.png)

### 6. (5 point)

![screenshot](screenshot.png)
![screenshot](C6D3.png)

### 7. (5 point)

![screenshot](screenshot.png)
![screenshot](C7D3.png)
5 changes: 3 additions & 2 deletions 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://user and [email protected]:51980/yelpdata", {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(200)
.toArray(function (err, items) {
res.render("business_map", {data: items});
});
Expand Down
1 change: 1 addition & 0 deletions business.mongo.json

Large diffs are not rendered by default.

23 changes: 18 additions & 5 deletions business_map.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@
}

.markers circle {
fill: brown;
stroke: black;
stroke-width: 1.5px;
fill-opacity: .5;
}

</style>
Expand All @@ -57,8 +57,15 @@

<script type="text/javascript">



var dataset = <%- JSON.stringify(data) %>;

var rScale = d3.scale.linear()
.domain([50, 5000])
.range(3, 15);


// Set the center location (lat/lng) to be the location of the first business
var first = dataset[0];
var centerLatLng = new google.maps.LatLng(first.latitude, first.longitude);
Expand Down Expand Up @@ -94,17 +101,23 @@

// Add a circle.
marker.append("svg:circle")
.attr("r", 4.5)
.attr("r", function(d) {return d.review_count/5000*15;})
.attr("cx", padding)
.attr("cy", padding)
.style("fill", function(d) {
if (d.stars >= 4) {return "red"}
else if (d.stars >=2) {return "brown"} else

{ return "black" }
;})
// Add a label.
marker.append("svg:text")

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

.text(function(d) { return d.review_count; });
*/
function transform(d) {
d = new google.maps.LatLng(d.latitude, d.longitude);
d = projection.fromLatLngToDivPixel(d);
Expand Down
Empty file added node_modules/ejs/.gitmodules
Empty file.
4 changes: 4 additions & 0 deletions node_modules/ejs/.npmignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions node_modules/ejs/.travis.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading