Skip to content

Instantly share code, notes, and snippets.

Avatar

Johannes E. M. Mosig JEM-Mosig

View GitHub Profile
View rasa_diagnostic_data_access.md

You can access diagnostic data for DIET like this (please define the YOUR_RASA_MODEL_DIRECTORY and YOUR_RASA_MODEL_NAME constants):

from rasa.cli.utils import get_validated_path
from rasa.model import get_model, get_model_subdirectories
from rasa.nlu.model import Interpreter
from rasa.shared.nlu.training_data.message import Message
from rasa.shared.nlu.constants import TEXT
from rasa.shared.constants import DIAGNOSTIC_DATA
import pathlib
View gist:9d302dbaf8933d3cd5e93e9e0945cf45
(rasa-master) jem-mosig:trivia/ (testing✗) $ rasa train core [13:31:03]
2020-08-14 13:31:16 ERROR pykwalify.core - validation.invalid
2020-08-14 13:31:16 ERROR pykwalify.core - --- All found errors ---
2020-08-14 13:31:16 ERROR pykwalify.core - ["Cannot find required key 'intent'. Path: '/rules/2/steps/2'", "Key 'form' was not defined. Path: '/rules/2/steps/2'", "Key 'form' was not defined. Path: '/rules/2/steps/2'", "Key 'form' was not defined. Path: '/rules/2/steps/2'", "Key 'form' was not defined. Path: '/rules/2/steps/2'", "Cannot find required key 'intent'. Path: '/rules/3/steps/2'", "Key 'form' was not defined. Path: '/rules/3/steps/2'", "Key 'form' was not defined. Path: '/rules/3/steps/2'", "Key 'form' was not defined. Path: '/rules/3/steps/2'", "Key 'form' was not defined. Path: '/rules/3/steps/2'", "Key 'form' was not defined. Path: '/rules/4/condition/0'", "Key 'form' was not defined. Path: '/rules/4/condition/0'", "Cannot find required key 'intent'. Path: '/rule
View trycatch.sh
#!/bin/bash
# Based on: https://stackoverflow.com/a/25180186
function try()
{
[[ $- = *e* ]]; SAVED_OPT_E=$?
set +e
}
function throw()
@JEM-Mosig
JEM-Mosig / simple_som.py
Created May 17, 2019
Simple self-organizing-map code (not optimized for performance)
View simple_som.py
import numpy as np
class SelfOrganizingMap(object):
def __init__(self, map_dims, input_dim):
self.map_dims = map_dims
self.input_dim = input_dim
@JEM-Mosig
JEM-Mosig / snickers.wl
Last active Apr 8, 2019
This Wolfram Language (Mathematica) code generates an interactive data-exploration tool for our Snickers experiment.
View snickers.wl
With[{
data = {<|"ID"->1,"Experimenter"->"Nellissa","Outcome"->"DE\[NotEqual]VN","Countries"->{"DE","VN"},"Same"->False,"Comment"->"One is sweet, the other caramelly"|>,<|"ID"->2,"Experimenter"->"Nellissa","Outcome"->"GB\[NotEqual]VN","Countries"->{"GB","VN"},"Same"->False,"Comment"->"One tasts like coffee and sweeter"|>,<|"ID"->3,"Experimenter"->"Nellissa","Outcome"->"DE\[Equal]VN","Countries"->{"DE","VN"},"Same"->True,"Comment"->""|>,<|"ID"->4,"Experimenter"->"Nellissa","Outcome"->"VN\[NotEqual]VN","Countries"->{"VN","VN"},"Same"->False,"Comment"->"One is sweeter"|>,<|"ID"->5,"Experimenter"->"Nellissa","Outcome"->"VN\[Equal]VN","Countries"->{"VN","VN"},"Same"->True,"Comment"->"Terrible"|>,<|"ID"->6,"Experimenter"->"Nellissa","Outcome"->"DE\[Equal]GB","Countries"->{"DE","GB"},"Same"->True,"Comment"->"(?) Tasts the same, peanutty and caramelly"|>,<|"ID"->7,"Experimenter"->"Nellissa","Outcome"->"GB\[NotEqual]VN","Countries"->{"GB","VN"},"Same"->False,"Comment"->"One is too sweet"|>,<|"ID"->8,"Experimenter"
@JEM-Mosig
JEM-Mosig / blog-mackay_gaussian_2006.md
Last active Apr 2, 2019
blog-mackay_gaussian_2006
View blog-mackay_gaussian_2006.md

Wolframscripts that generate figures in my blog post

The scripts in this gist generate the animated figures in my blog post mackay_gaussian_2006. You need Wolfram Mathematica 11 or higher to run these scripts. For example,

wolframscript <name>.wls

will generate the figure <name>.png in the current directory, where <name> is the name of the script.

View keybase.md

Keybase proof

I hereby claim:

  • I am jem-mosig on github.
  • I am jem_mosig (https://keybase.io/jem_mosig) on keybase.
  • I have a public key ASAnLueCCtiZfcA2CwDEuR0Ix98vVWVD9zKZcn5zTBtEHwo

To claim this, I am signing this object:

@JEM-Mosig
JEM-Mosig / CodeCompatibilityData.wl
Last active Oct 21, 2017
Simple code to estimate the compatibility of a Wolfram Language script
View CodeCompatibilityData.wl
(* author: https://github.com/JEM-Mosig *)
(* example: CodeCompatibilityData["test.wl"] *)
ClearAll[CodeCompatibilityData];
CodeCompatibilityData[wlFile_String] := Module[{str, symbols},
(* read the whole file as a string *)
str = ReadString[wlFile];
(* delete all strings in the code *)
str = StringDelete[str,"\""~~Shortest[___]~~"\""];
(* delete all comments in the code (unsafe!) *)