This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def train(lam, num_features, rate = 0.1): | |
iter = 0 | |
P = defaultdict(np.array) | |
Q = defaultdict(np.array) | |
# initialize P and Q | |
for k, v in user_item_rating_train.items(): | |
P[k[0]] = np.random.uniform(size = num_features) | |
Q[k[1]] = np.random.uniform(size = num_features) | |
initial_mse = validate(user_item_rating_train, P, Q) | |
print ("initial mse", initial_mse) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.*; | |
class Pair { | |
int x; | |
int y; | |
public Pair(int x, int y){ | |
this.x = x; | |
this.y = y; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Page Title</title> | |
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/angular.min.js"></script> | |
</head> | |
<body> | |
<div ng-app="app" ng-controller="MainCtrl" class="list-group"> | |
<div class="list-group-item" ng-repeat="item in messages"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
$ python app.py | |
put this in your browser: http:127.0.0.1:5000 to view the json | |
''' | |
from flask import Flask | |
from flask_sqlalchemy import SQLAlchemy | |
from flask import render_template | |
import json | |
app = Flask(__name__) |
NewerOlder