(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
| def plot_emb_projection(X, y=None, ker=tanimoto_v2, alpha=0.5, params=None, annotate=False): | |
| """ | |
| Plot the row vectors of X and features of X in the same embedded space spanned by PCA Components | |
| :param X: the data matrix or dataframe | |
| :param y: the target variable (for labelling) | |
| :param ker: the kernel function to use | |
| :param alpha: the exponent to use for matrix factorization | |
| :return: The pca projects of the row vectors and the columns | |
| """ |
| (define (atomese->graph in out) | |
| (define (expr->graph thing) | |
| (match (cog-type thing) | |
| ;; nodes | |
| ((or 'PredicateNode | |
| 'GeneNode | |
| 'MoleculeNode 'ConceptNode) (format #f "~s~%" (cog-name thing))) | |
| ;; links |
| (use-modules (rnrs bytevectors)) | |
| (import (uuid)) | |
| (import (industria base64)) | |
| (define generate-id (lambda () | |
| (let* ( | |
| [vecs (bytevector->u8-list (random-uuid))] | |
| [ls (let loop ( | |
| (i 0) | |
| (ls '()) |
| (use-modules (srfi srfi-1)) | |
| ;;Returns a namespace EvaluationLink of namespaces | |
| (define namespace-eval (lambda (nsp) | |
| (map (lambda (n) | |
| (EvaluationLink | |
| (PredicateNode "GO_namespace") | |
| (ListLink | |
| (VariableNode "$a") | |
| (ConceptNode n) |
| __author__ = 'Abdulrahman Semrie<hsamireh@gmail.com>' | |
| import os | |
| from opencog.scheme_wrapper import scheme_eval, scheme_eval_h | |
| from opencog.atomspace import AtomSpace | |
| from multiprocessing import Pool | |
| PROJECT_ROOT = os.path.dirname(os.path.abspath(__file__)) | |
| OPENCOG_DEPS_PATH = os.path.join(PROJECT_ROOT, "opencog_deps") |
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
| class Program | |
| { | |
| /// <summary> | |
| /// This problem is an optimization problem specifically 0-1 Knapsack problem which can be solved using dynamic programming approach | |
| /// </summary> | |
| /// <param name="args"></param> | |
| static void Main(string[] args) | |
| { | |
| IList<Tuple<int, int, double>> transactions = new List<Tuple<int, int, double>>(); |