You are an AI language model assisting in the development of a project using the SPARC framework, which consists of the following steps:
- Specification
- Pseudocode
- Architecture
- Refinement
| def recalculate_user(user_ratings): | |
| '''adds new user and its liked items to sparse matrix and returns recalculated recommendations''' | |
| alpha = 40 | |
| m = load_npz('sparse_user_item.npz') | |
| n_users, n_movies = m.shape | |
| ratings = [alpha for i in range(len(user_ratings))] |
| #!comment: This allegedly waa a list of "the top 100,000 most frequently-used English words", see the repo I forked for more provenance. | |
| #!comment: But it was very un-sanitized. I had a specific purpose in mind, and thought it might be somewhat more generally useful to have/share in the future, so here's how I sanitized the list: | |
| #!comment: 0) put a number on each word (I should note that somehow it only included 98,913 to start with) | |
| #!comment: 1) change all words to lower-case | |
| #!comment: 2) blank out any words with characters other than a-z | |
| #!comment: 3) remove any duplicates, keeping the lower (more frequent) number | |
| #!comment: Now the list is 62916 words long, and still contains a lot of non-English words, but I think it is more useful. | |
| #!comment: | |
| #!comment: Format: Rank (original rank) Word | |
| 1 (1) the |
| function sync() { | |
| // ID(s) of personal calendar(s) | |
| var secondary_calendars = [ | |
| 'xxxxxxx', | |
| ]; | |
| var today=new Date(); | |
| var enddate=new Date(); | |
| enddate.setDate(today.getDate()+90); // how many days in advance to monitor and block off time |
| SHOPIFY_API_KEY = 'my-key' | |
| SHOPIFY_PASSWORD = 'my-pass' | |
| STORE_NAME = 'my-store' |
| function make_shipping_rates(id, low, mid, high) { | |
| $.post('/admin/price_based_shipping_rates.json', { | |
| price_based_shipping_rate: { | |
| country_id: id, | |
| min_order_subtotal: "0", | |
| max_order_subtotal: "500", | |
| name: "DHL Premiumversand", | |
| offsets: [], | |
| price: low | |
| } |
| #!/usr/bin/perl | |
| use Mysql; | |
| use strict; | |
| use vars qw($school_name); | |
| use vars qw($pass); | |
| require "./cgi-lib.pl"; |
| import random | |
| envs = [10.0, 20.0] | |
| rounds = 10000 | |
| total_stay = 0 | |
| for x in xrange(rounds): | |
| t_envs = envs[:] | |
| random.shuffle(t_envs) | |
| choice = t_envs.pop() |
| from fabric.api import env, local, require | |
| def deploy(): | |
| """fab [environment] deploy""" | |
| require('environment') | |
| maintenance_on() | |
| push() | |
| syncdb() | |
| migrate() |