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 numpy as np | |
import torch | |
from recbole.data.interaction import Interaction | |
@torch.no_grad() | |
def full_sort_scores(uid_series, model, test_data, device=None): | |
"""Calculate the scores of all items for each user in uid_series. | |
Note: |
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 Select from 'react-select' | |
import { List } from 'react-virtualized' | |
import React, { useState, Component } from 'react' | |
import { filter } from 'lodash/fp' | |
const MenuList = props => { | |
const rows = props.children | |
const rowRenderer = ({ key, index, isScrolling, isVisible, style }) => ( | |
<div key={key} style={style}> | |
{rows[index]} |
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 fast_access_sparse_matrix(idx, row, sparse_matrix): | |
# index | |
start, stop = sparse_matrix.indptr[idx], sparse_matrix.indptr[idx+1] | |
index_data = sparse_matrix.data[start:stop] | |
index_rows = sparse_matrix.indices[start:stop] | |
# row | |
## find row index | |
if row in index_rows: | |
row_index = np.where(index_rows==row)[0][0] | |
extract_elements = index_data[row_index] |
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 math | |
def precision_and_recall(ranked_list, ground_list): | |
hits = 0 | |
for i in range(len(ranked_list)): | |
id = ranked_list[i] | |
if id in ground_list: | |
hits += 1 | |
pre = hits / (1.0 * len(ranked_list)) | |
rec = hits / (1.0 * len(ground_list)) | |
return pre, rec |
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
--- | |
title: "pokemontest" | |
output: html_document | |
--- | |
## 列数 | |
```{r} | |
#データの読み込み | |
df<-read.csv('../dataset/pokemon.csv',encoding = 'utf-8',sep='\t') | |
#列数の取得 |