Skip to content

Instantly share code, notes, and snippets.

View myui's full-sized avatar

Makoto YUI myui

View GitHub Profile

image

def compute_similarity_weight(num_contacts: int, max_val: float=2.0, k: float=1.0) -> float:
    """
    Compute the similarity weighting factor based on the number of user-item interactions.

    Args:
        num_contacts (int): Number of user-item interactions.
 max_val (float): Maximum value for the similarity weighting factor.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
from typing import List
import numpy as np
from numpy.typing import ArrayLike
import scipy.sparse as sp
from sklearn.linear_model import ElasticNet
import warnings
from sklearn.exceptions import ConvergenceWarning
from tqdm import tqdm
class ColumnarView:
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@myui
myui / slim_elastic.py
Created November 22, 2024 05:54
SLIM Elastic
import numpy as np
import scipy.sparse as sp
from sklearn.linear_model import ElasticNet
import warnings
from sklearn.exceptions import ConvergenceWarning
class SLIMElastic:
"""
SLIMElastic is a sparse linear method for top-K recommendation, which learns
a sparse aggregation coefficient matrix by solving an L1-norm and L2-norm
@myui
myui / devcontainer.json
Created June 4, 2024 16:49
devcontainer.json
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
// https://github.com/microsoft/vscode-dev-containers/tree/v0.231.6/containers/docker-existing-dockerfile
{
"name": "AutoML",
"image": "digdag/automl:3.8.1",
"runArgs": ["--platform=linux/amd64"],
"containerEnv": {
// To enable integrated terminal
"SHELL": "/bin/bash",
"HOME": "/home/td-user"