Install requirements: pip3 install -r requirements.txt
Copy example_default_profile.yaml to default_profile.yaml and modify to point to your database
Run python3 run_webapp.py
Enter http://localhost:5001/
in your local browser
Tyra is designed to work on different data science projects, but to accomplish this it expects a standard model storage interface; a Postgres database with a results
schema containing three tables, models
, evaluations
, and predictions
.
Whether or not the model_id
and as_of_date
columns in predictions
and evaluations
are defined as a foreign key, they should act as one as the tables are joined using it.
No assertions are made on other tables in the results
schema or other schemas, or on other columns in these tables.
The list of metrics that will be displayed to the user currently lives in parameters.yaml
. The currently shipped list looks like this:
Both absolute value and percent thresholding are supported for metric parameters. The format for each one in the results.evaluations.parameter
is as follows:
100_abs
(top 100 entities)
10.0_pct
(top 10%)
Tyra expects these metrics to be computed ahead of time, so if your evaluation code does not compute all of these thresholds for all of the threshold-able metrics ahead of time, we recommend removing entries from parameters.yaml to make the lists match up and avoid confusion in the UI.
Since Tyra is built to look at different project databases, being able to run multiple instances side-by-side is helpful. To accomplish this, you can pass environment variables to configure the database credential file path and the port. So these two commands will work:
PROFILE=/path/to/first/profile.yaml PORT=5001 python3 run_webapp.py
PROFILE=/path/to/second/profile.yaml PORT=5002 python3 run_webapp.py
Tyra uses NodeJS and Webpack to organize and bundle frontend dependencies.
Install NodeJS (https://nodejs.org/en/)
cd frontend
npm install
to install dependencies (the initial install will take a few minutes, go have a snack!)
npm run build
to initially create the bundled javascript file
Sometimes node and npm versions from package managers are ancient and need to be upgraded before installation will work.
To upgrade node to the latest stable version:
sudo npm cache clean -f
sudo npm install -g n
sudo n stable
To upgrade npm:
sudo npm install npm@latest -g
npm run start
will start a webpack '--watch' command that watches your javascript and compiles it to webapp/static/output.js. The initial startup will probably take 10-15 seconds, but every time you save a javascript file the recompilation will be much quicker.
New components can be added in the frontend/components
directory. There is a directory for each component, because soon (not yet) we will start bundling styles in individual component directories. Other components will be able to import your new component right away, but if you would like the component to made available globally (in other words, a Flask template), you will have to add this to frontend/index.js
In the frontend
directory, install the package you want with npm install --save <pkg-name>
. The --save option will persist this change to package.json.