Skip to content

Instantly share code, notes, and snippets.

for iter=1:iterations
for row_train=1:size(train_user,1)
i=train_user(row_train);
j=train_movie(row_train);
r= train_rating(row_train);
u_i=U(i);
v_j=V(j);
for p=1:nDims
dJ_u=alpha*sum((transpose(u_i)*v_j-r)*transpose(v_j))+lambda*V(j,p);
U(i,p) = U(i,p) - dJ_u;
<html style="width:100%; height:100%; overflow:hidden">
<head>
<!-- You can include external scripts here like so... -->
<!--<script src="https://cdnjs.cloudflare.com/ajax/libs/zepto/1.0/zepto.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.5.2/underscore-min.js"></script>-->
</head>
<body style="width:100%; height:100%; overflow:hidden; margin:0" bgcolor="#000">
<canvas id="canvas" width="640" height="360" style="display:block"></canvas>
<script>
function server() {
@minakhan01
minakhan01 / glass.html
Last active August 29, 2015 14:11
[wearscript] glass_basic.html
<html style="width:100%; height:100%; overflow:hidden">
<head>
<!-- You can include external scripts here like so... -->
<!--<script src="https://cdnjs.cloudflare.com/ajax/libs/zepto/1.0/zepto.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.5.2/underscore-min.js"></script>-->
</head>
<body style="width:100%; height:100%; overflow:hidden; margin:0" bgcolor="#000">
<canvas id="canvas" width="640" height="360" style="display:block"></canvas>
<script>
function server() {
@minakhan01
minakhan01 / glass.html
Last active August 29, 2015 14:11
[wearscript] pub_subs.html
<!-- WearScript on Glass/Android -->
<html style="width:100%; height:100%; overflow:hidden">
<body style="width:100%; height:100%; overflow:hidden; margin:0">
<script>
function main() {
if (WS.scriptVersion(1)) return;
WS.say('Welcome to WearScript');
WS.serverConnect('{{WSUrl}}', function () {
WS.subscribe('pong', function (chan, timestamp0, timestamp1, groupDevice) {
WS.log('Pong: ' + groupDevice + ': Remote - Glass0: ' + (timestamp1 - timestamp0) + ' Glass1 - Glass0: ' + (((new Date).getTime() / 1000) - timestamp0));
@minakhan01
minakhan01 / glass.html
Last active August 29, 2015 14:11
[wearscript] client.html
<!-- WearScript on Glass/Android -->
<html style="width:100%; height:100%; overflow:hidden">
<body style="width:100%; height:100%; overflow:hidden; margin:0">
<script>
function main() {
if (WS.scriptVersion(1)) return;
WS.serverConnect('{{WSUrl}}', function () {
WS.sensorOn('accelerometer', .25);
WS.cameraOn(1);
WS.dataLog(false, true, .15);
@minakhan01
minakhan01 / glass.html
Created December 11, 2014 02:40
[wearscript] hn.html
<html style="width:100%; height:100%; overflow:hidden">
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/zepto/1.0/zepto.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.5.2/underscore-min.js"></script>
</head>
<body style="width:100%; height:100%; overflow:hidden; margin:0">
<canvas id="canvas" width="640" height="360" style="display:block"></canvas>
<script>
function hn(data) {
dataItems = data.items;
A=["c-1255,953-320x180-1678e-int0003_bewerkt.jpg",
"c-1448,1115-320x180-DSC_0561.jpg",
"c-1571,1128-320x180-dvds-808.jpg",
"c-1623,760-320x180-ad-Nige-.jpg",
"c-1731,1350-320x180-472.JPG",
"c-1778,1273-320x180-SAM_2166.jpg",
"c-1880,1275-320x180-boats-at-the-pier.jpg",
"c-1928,1157-320x180-808-supermarket.jpg",
"c-2016,1123-320x180-6a00e54f97ee2f8833017d3c9f81c1970c-pi.jpg",
"c-2074,558-320x180-NFgd2kP.jpg",
using UnityEngine;
using System.Threading.Tasks;
using Windows.Storage.Streams;
#if NETFX_CORE
using System;
using Windows.Devices.Enumeration;
using Windows.Devices.Bluetooth;
using Windows.Devices.Bluetooth.GenericAttributeProfile;
using Windows.Devices.Bluetooth.Advertisement;
#endif
using UnityEngine;
using System.Threading.Tasks;
using Windows.Storage.Streams;
#if NETFX_CORE
using System;
using Windows.Devices.Enumeration;
using Windows.Devices.Bluetooth;
using Windows.Devices.Bluetooth.GenericAttributeProfile;
using Windows.Devices.Bluetooth.Advertisement;
#endif
using UnityEngine;
using System.Threading.Tasks;
using Windows.Storage.Streams;
#if NETFX_CORE
using System;
using Windows.Devices.Enumeration;
using Windows.Devices.Bluetooth;
using Windows.Devices.Bluetooth.GenericAttributeProfile;
using Windows.Devices.Bluetooth.Advertisement;
#endif