This file contains hidden or 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
| # Change the prefix | |
| set -g prefix C-s | |
| # Set vim-style key bindings | |
| setw -g mode-keys vi | |
| # Start selection with 'v' in copy mode | |
| # Added because 'v' selection wasn't working despite 'V' line selection working | |
| bind -T copy-mode-vi v send -X begin-selection |
This file contains hidden or 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
| #!/bin/bash | |
| # doi_or_title_fetcher.sh | |
| # Usage examples: | |
| # ./doi_or_title_fetcher.sh "10.1145/3511808.3557220" | |
| # ./doi_or_title_fetcher.sh "Promptagator Few-shot dense retrieval from 8 examples" | |
| # | |
| # Install bibtex-tidy to use this script: | |
| # >> npm install -g bibtex-tidy | |
| # |
This file contains hidden or 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
| """ | |
| A script to generate Marp presentation slides from quiz questions stored in JSON format. | |
| This script takes a JSON file containing quiz questions and generates a Markdown file formatted | |
| for Marp presentations. Each question is placed on its own slide. The output follows Marp's | |
| markdown syntax with appropriate slide separators and formatting. | |
| Functions: | |
| create_marp_header() -> str: Creates the YAML front matter for Marp slides | |
| format_question_slide(question_data: dict) -> str: Formats a single question into a slide |
This file contains hidden or 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 | |
| from scipy import sparse | |
| from tqdm import tqdm | |
| import numba | |
| from numba import jit, float64, int64 | |
| from numba.experimental import jitclass | |
| def calc_ppr_forward_push_fast(adj, source_nodes=None, alpha=0.15, epsilon=1e-6, batch_size=1000): | |
| """ | |
| Compute Personalized PageRank (PPR) scores for specified source nodes using a numba-accelerated forward push method. |
This file contains hidden or 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 | |
| from scipy import sparse | |
| # | |
| # Randomized SVD | |
| # | |
| def rSVD(X, dim, **params): | |
| if isinstance(X, list): | |
| return _rSVD_submatrices(X, r=dim, **params) |
This file contains hidden or 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
| from tqdm import tqdm | |
| import numpy as np | |
| import pandas as pd | |
| import scipy.sparse as sparse | |
| def preferential_attachment_model_empirical( | |
| t0, nrefs, net_train, t_start, mu=None, sig=None, c0=20, n0=0 | |
| ): | |
| """ |
This file contains hidden or 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
| # Efraimidis and Spirakis algorithm | |
| # https://www.sciencedirect.com/science/article/abs/pii/S002001900500298 | |
| import numpy as np | |
| from numba import njit | |
| @njit(nogil=True) | |
| def one_pass_sampling_without_replacement(n, k, weights): | |
| # Draw a uniform random variable for each item | |
| u = np.random.rand(n) |
This file contains hidden or 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 | |
| from scipy import sparse | |
| # | |
| # Evaluation | |
| # | |
| def calc_esim(y, ypred, normalize=False): | |
| """ | |
| Element centric similarity. | |
This file contains hidden or 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
| """Non-backtracking spectral embedding | |
| Reference | |
| --------- | |
| Krzakala, Florent, et al. "Spectral redemption in clustering sparse networks." Proceedings of the National Academy of Sciences 110.52 (2013): 20935-20940. | |
| Example | |
| ------- | |
| ```python |
This file contains hidden or 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
| # -*- coding: utf-8 -*- | |
| # @Author: Sadamori Kojaku | |
| # @Date: 2022-10-05 06:24:53 | |
| # @Last Modified by: Sadamori Kojaku | |
| # @Last Modified time: 2023-05-19 13:04:26 | |
| import sys | |
| from tqdm.auto import tqdm | |
| import numpy as np | |
| import pandas as pd | |
| import torch |
NewerOlder