This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| --- | |
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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) |