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
# Copyright 2024 AI INSIGHT SOLUTIONS INC. | |
import timeit | |
from pathlib import Path | |
import numpy as np | |
import onnx | |
import onnxruntime as rt | |
import torch | |
from onnxruntime.quantization import QuantType, quantize_dynamic |
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 dot_product(x, kernel): | |
""" | |
Wrapper for dot product operation, in order to be compatible with both | |
Theano and Tensorflow | |
Args: | |
x (): input | |
kernel (): weights | |
Returns: | |
""" | |
if K.backend() == 'tensorflow': |
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
#Define the problem | |
t1 <- Sys.time() | |
set.seed(1) | |
n_nodes <- 300000L | |
n_edges <- 900000L | |
nodes <- 1L:n_nodes | |
edge_node_1 <- sample(nodes, n_edges, replace=TRUE) | |
edge_node_2 <- sample(nodes, n_edges, replace=TRUE) | |
#Sparse matrix |
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
#Option 1 - install openblas with homebrew and link to CRAN installed R | |
brew tap homebrew/science | |
brew install openblas | |
ln -sf /usr/local/Cellar/openblas/0.2.12/lib/libopenblas.dylib /Library/Frameworks/R.framework/Resources/lib/libRblas.dylib | |
#Option 2 - install r with openblas through homebrew | |
brew tap homebrew/science | |
brew install r --with-openblas |
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
program hello | |
print *, "Hello World!" | |
end program hello |
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
cd /Library/Frameworks/R.framework/Resources/lib | |
# for vecLib use | |
ln -sf libRblas.vecLib.dylib libRblas.dylib | |
# for R reference BLAS use | |
ln -sf libRblas.0.dylib libRblas.dylib |
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
multiRF <- function(X, Y, mtry_vector,...) { | |
stopifnot(require(doRNG)) | |
stopifnot(require(randomForest)) | |
stopifnot(is.numeric(mtry_vector)) | |
stopifnot(all(mtry_vector>1)) | |
foreach(i=mtry_vector,.combine=randomForest::combine,.packages='randomForest',.export=c('X','Y'),.inorder=FALSE) %dorng% { |
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
#Setup | |
rm(list = ls(all = TRUE)) | |
gc(reset=TRUE) | |
set.seed(1234) #From random.org | |
#Libraries | |
library(caret) | |
library(devtools) | |
install_github('caretEnsemble', 'zachmayer') #Install zach's caretEnsemble package | |
library(caretEnsemble) |
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
#Setup | |
rm(list = ls(all = TRUE)) | |
gc(reset=TRUE) | |
set.seed(42) #From random.org | |
#Libraries | |
library(caret) | |
library(devtools) | |
install_github('caretEnsemble', 'zachmayer') #Install zach's caretEnsemble package |
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
<html> | |
<head> | |
<title>Test</title> | |
<meta name="viewport" content="user-scalable=no, width=device-width, initial-scale=1.0, maximum-scale=1.0"/> | |
<meta name="apple-mobile-web-app-capable" content="yes" /> | |
<meta name="apple-mobile-web-app-status-bar-style" content="black" /> | |
<link rel="apple-touch-icon" href="icon.png"/> | |
<style type="text/css"> | |
body{ margin: 0px;} | |
</style> |
NewerOlder