Skip to content

Instantly share code, notes, and snippets.

View M49ICKPIxi3's full-sized avatar

Clair Marie M49ICKPIxi3

View GitHub Profile
@gulshanbaraik01
gulshanbaraik01 / random_walk_method.py
Created June 21, 2020 11:14
Random Walk Method - Page Rank Algorithm using networkx
# Importing the necessary libraries to execute the "Random Walk Method"
import networkx as nx
import random
import matplotlib.pyplot as plt
import operator
#select random graph using gnp_random_graph() function of networkx
Graph = nx.gnp_random_graph(10, 0.5, directed=True)
nx.draw(Graph, with_labels=True, node_color='green') #draw the network graph
plt.figure(figsize=(15,10))
@sysang
sysang / deep-learning.md
Last active August 9, 2023 01:43
Awesome Git Repositories: Deep Learning, NLP, Compute Vision, Model & Paper, Chatbot, Tensorflow, Julia Lang, Software Library, Reinforcement Learning
@huikang
huikang / perplexity.py
Created October 23, 2019 16:43
calculate perplexity
import math
import torch
from transformers import BertTokenizer, BertModel, BertForMaskedLM, OpenAIGPTLMHeadModel, OpenAIGPTTokenizer
# Load pre-trained model (weights)
model = OpenAIGPTLMHeadModel.from_pretrained('openai-gpt')
model.eval()
# Load pre-trained model tokenizer (vocabulary)
tokenizer = OpenAIGPTTokenizer.from_pretrained('openai-gpt')
@cwhy
cwhy / nips2018.md
Last active January 11, 2024 13:17
NIPS 2018 Abstract

Unsupervisedly Learned Latent Graphs as Transferable Representations

Modern deep transfer learning approaches have mainly focused on learning \emph{generic} feature vectors from one task that are transferable to other tasks, such as word embeddings in language and pretrained convolutional features in vision. However, these approaches usually transfer unary features and largely ignore more structured graphical representations. This work explores the possibility of learning generic latent graphs that capture dependencies between pairs of data units (e.g., words or pixels) from large- scale unlabeled data and transferring the graphs to downstream tasks. Our

@aparrish
aparrish / a-reasonable-introduction.ipynb
Last active September 7, 2022 08:59
Workshop notebook. Code examples released under CC0 https://creativecommons.org/choose/zero/, other text released under CC BY 4.0 https://creativecommons.org/licenses/by/4.0/
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@aparrish
aparrish / shmarkov.py
Last active January 22, 2021 13:04
shmarkov.py, a set of functions for simple and concise markov chain text generation in Python. should work in python 2 and python 3
# shmarkov.py, simple and concise markov chain text generation
# Copyright (C) 2018 Allison Parrish
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated documentation files (the “Software”), to deal in
# the Software without restriction, including without limitation the rights to
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
# of the Software, and to permit persons to whom the Software is furnished to do
# so, subject to the following conditions:
@rjfranco
rjfranco / anime-movie-classics.md
Last active November 11, 2020 06:28
Anime Movie Classics

Anime Movie Classics

This is a list of films I plan to watch this year, hoping to have movie nights over at my place. Figured I'd put the list somewhere shareable so I can seek contributions easily. The checkboxes are meant to indicate if they have been watched as part of the event, some entries are being added as already watched however because although we don't plan to watch them, they definitely should count as an anime movie classic.

Various or Uknown Directors

  • Devilman
  • Memories
  • Neo-Tokyo

Satoshi Kon

@spiderChow
spiderChow / Feature Extraction.py
Last active October 21, 2018 01:45
how to use sklearn to extract features from text
'''
From text
# + The sklearn.feature_extraction.text submodule gathers utilities to build feature vectors from text documents.
# > **feature_extraction.text.CountVectorizer([…])** Convert a collection of text documents to a matrix of token counts
# > **feature_extraction.text.HashingVectorizer([…])** Convert a collection of text documents to a matrix of token occurrences
# > **feature_extraction.text.TfidfTransformer([…])** Transform a count matrix to a normalized tf or tf-idf representation
# > **feature_extraction.text.TfidfVectorizer([…])** Convert a collection of raw documents to a matrix of TF-IDF features.
'''
@aparrish
aparrish / tracery-with-data.ipynb
Last active June 9, 2024 20:47
Tracery and Python. Code examples released under CC0 https://creativecommons.org/choose/zero/, other text released under CC BY 4.0 https://creativecommons.org/licenses/by/4.0/
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@evansde77
evansde77 / mock_requests.py
Last active February 11, 2026 14:52
Example of mocking requests calls
#!/usr/bin/env python
"""
mocking requests calls
"""
import mock
import unittest
import requests
from requests.exceptions import HTTPError