Skip to content

Instantly share code, notes, and snippets.

---
name: value-of-information
description: >
Calculate the Expected Value of Information (EVI / EVPI) to determine whether
gathering more data before a decision is worth the cost. Use this skill
whenever the user is deciding whether to do research, run a study, conduct a
survey, buy a report, or collect more data before acting. Trigger on: "is this
research worth it?", "should we do market research?", "is the survey worth
buying?", any mention of EVPI, EVI, EOL, Expected Opportunity Loss, or Value
of Information, or any cost-benefit question about information gathering. Also
@gnurio
gnurio / convert_archive.py
Created February 16, 2025 20:16 — forked from deepfates/convert_archive.py
Convert your twitter archive into a training dataset and markdown files
import argparse
import json
import logging
import os
import re
import shutil
from concurrent.futures import ProcessPoolExecutor, as_completed
from dataclasses import dataclass
from datetime import datetime
from typing import Any, Callable, Dict, List, Literal, Optional, Tuple
@gnurio
gnurio / decode_encode_onehot
Created February 22, 2018 22:49
Re-coding a categorical field into one-hot vectors
import pandas as pd
from sklearn.preprocessing import LabelEncoder,OneHotEncoder
def decode_encode(colname):
'''
(str) -> (DataFrame)
Returns a Data Frame with the column given to it transformed into a One-hot encoded set of columns
@gnurio
gnurio / gist:c3bd6d5fa9d67880014e5660df1368f8
Created March 21, 2017 23:43
How to calculate the mode for different categories in a DataFrame
import pandas as pd
from scipy.stats import mode
grouped_mod = df.pivot_table(values='The metric you need the mode for',columns='Category',aggfunc=mode)