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
1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20 | |
4.08,-0.29,6.36,4.37,-2.38,-9.66,-0.73,-5.34,8.88,9.22,6.75,8.64,4.42,7.43,4.56,-0.97,4.66,-0.68,3.3,-1.21 | |
-6.17,-3.54,0.44,-8.5,-7.09,-4.32,-8.69,-0.87,-6.65,-1.8,-6.8,-5.73,-5.0,-8.59,0.49,-8.93,-3.69,-2.18,-2.28,-6.12 | |
6.84,3.16,9.17,-6.21,-8.16,-1.7,9.27,1.41,-5.19,-4.42,8.2,-7.86,-6.94,-7.96,0.29,-9.9,-7.09,-7.18,1.02,-0.29 | |
-3.79,-3.54,-9.42,-6.89,-8.74,-0.29,-5.29,-8.93,-7.86,-1.6,-2.91,-0.29,-4.85,-0.49,-8.74,-6.99,-8.74,-2.91,-3.35,-0.29 | |
1.31,1.8,2.57,-2.38,0.73,0.73,-0.97,5.0,-7.23,-1.36,3.83,1.75,5.63,-2.86,-1.8,-2.04,5.53,-0.29,-0.58,1.36 | |
9.22,9.27,9.22,8.3,7.43,0.44,3.5,8.16,5.97,8.98,3.74,5.87,8.69,6.31,1.07,-9.13,3.69,-7.33,3.88,-7.48 | |
8.79,-5.78,6.02,3.69,7.77,-5.83,8.69,8.59,-5.92,7.52,-4.85,-7.28,-6.75,-1.99,-3.79,4.42,4.85,-8.83,-7.96,0.49 | |
-3.5,1.55,2.33,-4.13,4.22,-2.28,-2.96,-0.49,2.91,1.99,-1.99,5.53,-4.66,4.9,2.52,-0.68,0.0,-2.23,-6.6,-0.29 | |
3.16,7.62,3.79,8.25,4.22,7.62,2.43,0.97,0.53,0.83,3.5,3.3,5.05,4.71,2.57,-0.73,1.02,-1.21,2.23,0.97 |
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
""" | |
Implementations of: | |
Probabilistic Matrix Factorization (PMF) [1], | |
Bayesian PMF (BPMF) [2], | |
Modified BPFM (mBPMF) | |
using `pymc3`. mBPMF is, to my knowledge, my own creation. It is an attempt | |
to circumvent the limitations of `pymc3` w/regards to the Wishart distribution: |
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 gen_data(nusers, nsamples, F, K): | |
"""Generate hyperparameters, parameters, and data for the Personalized | |
Mixture of Gaussian Regressions model. | |
Args: | |
nusers (int): Number of distinct users. | |
nsamples (int): Total number of samples to generate. | |
F (int): Number of features for feature vectors. | |
K (int): Number of clusters. | |
Return: |
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 os | |
import re | |
import sys | |
from gensim.corpora import textcorpus | |
from gensim import utils | |
class NewsgroupCorpus(textcorpus.TextDirectoryCorpus): |
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 os | |
import logging | |
import argparse | |
logger = logging.getLogger(__name__) | |
def scan_and_fix_if_needed(module_path, dry_run=False): | |
# first read in the file | |
logger.info(f"scanning module {module_path}") |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 json | |
import numpy as np | |
def is_diagonal(matrix): | |
return np.count_nonzero(matrix - np.diag(np.diagonal(matrix))) == 0 | |
def is_identity(matrix): |