Skip to content

Instantly share code, notes, and snippets.

// Copyright (c) 2014 Hartmut Kaiser
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// This is the fourth in a series of examples demonstrating the development of
// a fully distributed solver for a simple 1D heat distribution problem.
//
// This example builds on example three. It futurizes the code from that
// example. Compared to example two this code runs much more efficiently. It
@shahrzad
shahrzad / fib_test
Last active February 7, 2018 20:30
// Copyright (c) 2018 Shahrzad Shirzad
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#include <phylanx/phylanx.hpp>
#include <hpx/hpx_init.hpp>
#include <iostream>
@shahrzad
shahrzad / prep.py
Last active September 17, 2018 15:20
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Jun 18 17:45:27 2018
@author: shahrzad
"""
from rdkit import Chem
from rdkit.Chem import MACCSkeys
from scipy.spatial import Voronoi, voronoi_plot_2d
import numpy as np
import pandas as pd
import matplotlib
import sys,os,argparse
from biopandas.mol2 import PandasMol2
import matplotlib.pyplot as plt
import glob
import cv2
from rdkit import Chem
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Jul 6 14:25:57 2018
@author: shahrzad
"""
import numpy as np
import time
import math
import pandas as pd
import numpy as np
import time
import argparse
import sys
if not len(sys.argv) == 7 :
print("This program requires the following 6 arguments seperated by a space ")
print("row_stop col_stop num_factors iterations regularization alpha")
exit(-57)
from phylanx import Phylanx
import numpy as np
@Phylanx
def ALS(ratings, regularization, num_factors, iterations, alpha, enable_output):
num_users = np.shape(ratings)[0]
num_items = np.shape(ratings)[1]
conf = alpha * ratings
conf_u = np.zeros((num_items,1))
#Python implementation of the ALS algorithm
import numpy as np
def ALS(ratings, regularization, num_factors, iterations, alpha, enable_output):
num_users = np.shape(ratings)[0]
num_items = np.shape(ratings)[1]
conf = alpha * ratings
conf_u = np.zeros((num_items,1))
conf_i = np.zeros((num_items,1))
define(als, ratings, regularization, num_factors, iterations, alpha, enable_output,
block(
define(num_users, shape(ratings, 0)),
define(num_items, shape(ratings, 1)),
define(conf, alpha * ratings),
define(conf_u, constant(0.0, make_list(num_items))),
define(conf_i, constant(0.0,make_list(num_users))),
define(c_u, constant(0.0, make_list(num_items, num_items))),
import pandas as pd
import numpy as np
import time
import argparse
import sys
if not len(sys.argv) == 7 :
print("This program requires the following 6 arguments seperated by a space ")
print("row_stop col_stop num_factors iterations regularization alpha")
exit(-57)