Skip to content

Instantly share code, notes, and snippets.

View hypnopump's full-sized avatar

Eric Alcaide hypnopump

View GitHub Profile
@ericminikel
ericminikel / rcdk-sar-tutorial.r
Last active May 2, 2020 11:49
Introductory tutorial on how to use rcdk to conduct an SAR
require(rcdk) # chemical informatics functionality in R
require(gap) # for qq plots later
options(stringsAsFactors=FALSE)
setwd('c:/sci/037cinf/analysis/sar/')
# plot molecules in R plot window instead of separate Java window
rcdkplot = function(molecule,width=500,height=500,marg=0,main='') {
par(mar=c(marg,marg,marg,marg)) # set margins to zero since this isn't a real plot
temp1 = view.image.2d(molecule,width,height) # get Java representation into an image matrix. set number of pixels you want horiz and vertical
plot(NA,NA,xlim=c(1,10),ylim=c(1,10),xaxt='n',yaxt='n',xlab='',ylab='',main=main) # create an empty plot
@ax3l
ax3l / CUDA_Compilers.md
Last active October 24, 2024 14:58
CUDA Compilers
@0xnurl
0xnurl / openfst_python_on_macos.md
Last active October 23, 2021 17:35
Installing OpenFST Native Python Extension on MacOS

Installing OpenFst Native Python Extension on MacOS

Starting from version 1.5, OpenFst has offered a native Python module, making the use of external wrappers like PyFst unnecessary. This has been greatly helpful since PyFst doesn't support Python 3.

1. Install OpenFst

@kenzotakahashi
kenzotakahashi / pytorch_gru.py
Last active February 4, 2020 17:35
PyTorch GRU example with a Keras-like interface.
import numpy as np
from sklearn.model_selection import train_test_split
import torch
import torch.nn as nn
from torch.autograd import Variable
np.random.seed(1337)
MAX_LEN = 30
@naoko
naoko / Install OpenFst with Python Binding on OSX
Last active October 23, 2021 19:38
How to install OpenFst with Python Biding on OSX
# download
curl -O http://www.openfst.org/twiki/pub/FST/FstDownload/openfst-1.6.2.tar.gz
tar -xvzf openfst-1.6.2.tar.gz
rm openfst-1.6.2.tar.gz
cd openfst-1.6.2
./configure --enable-python
make
make install
# Test installtion
@rwightman
rwightman / median_pool.py
Last active August 13, 2024 10:57
PyTorch MedianPool (MedianFilter)
import math
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn.modules.utils import _pair, _quadruple
class MedianPool2d(nn.Module):
""" Median pool (usable as median filter when stride=1) module.
@SLAPaper
SLAPaper / reuters_mlp_comparison (relu, elu, selu, swish).py
Last active October 26, 2021 19:41
Compare RELU, ELU, SELU, Swish and Scaled Swish in Reuters MLP (based on Keras' example)
'''Compares self-normalizing MLPs with regular MLPs.
Compares the performance of a simple MLP using two
different activation functions: RELU and SELU
on the Reuters newswire topic classification task.
# Reference:
Klambauer, G., Unterthiner, T., Mayr, A., & Hochreiter, S. (2017).
Self-Normalizing Neural Networks. arXiv preprint arXiv:1706.02515.
https://arxiv.org/abs/1706.02515
@jonathanBieler
jonathanBieler / cmaes.jl
Last active December 18, 2019 12:26
CMAES.jl
module CMAES
using Optim, Distributions, Parameters
import Optim: ZerothOrderOptimizer, ZerothOrderState, initial_state, update_state!,
trace!, assess_convergence, AbstractOptimizerState, update!, value, value!, pick_best_x,
pick_best_f
struct CMA <: Optim.ZerothOrderOptimizer
λ::Int
σ::Float64
@HadrienG2
HadrienG2 / High_Performance_Rust.md
Last active October 29, 2024 02:08
Making Rust a perfect fit for high-performance computations

Hello, Rust community!

My name is Hadrien and I am a software performance engineer in a particle physics lab. My daily job is to figure out ways to make scientific software use hardware more efficiently without sacrificing its correctness, primarily by adapting old-ish codebases to the changes that occured in the software and computing landscape since the days where they were designed:

  • CPU clock rates and instruction-level parallelism stopped going up, so optimizing code is now more important.
  • Multi-core CPUs went from an exotic niche to a cheap commodity, so parallelism is not optional anymore.
  • Core counts grow faster than RAM prices go down, so multi-processing is not enough anymore.
  • SIMD vectors become wider and wider, so vectorization is not a gimmick anymore.
@hypnopump
hypnopump / dihedral_angle_from_coordinates.py
Last active February 29, 2024 20:53
Dihedral angles from coordinates. Get dihedral angles from protein backbone coordinates. Calculate Phi, Psi from 3D coordinates of (N-term, C-alpha and C-term)
""" Dihedral angles from coordinates. Get dihedral angles from
protein backbone coordinates.
This script takes 4 vectors representing 4 points as input
and returns the dihedral angle between them.
The script was originally developed to calculate dihedral angles (phi,psi)
from protein backbone atoms' coordinates in 3D (N-term, C-alhpa, Cterm).
"""
import numpy as np