This file contains 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
unit = dfhack.gui.getSelectedUnit() | |
PlusPlus = {700, 1200, 1400, 1500, 1600, 1800, 2500} | |
Plus = {450, 950, 1150, 1250, 1350, 1550, 2250} | |
Normal = {200, 700, 900, 1000, 1100, 1300, 2000} | |
Minus = {150, 600, 800, 900, 1000, 1100, 1500} | |
PhysicalPlus = {"STRENGTH", "TOUGHNESS", "ANALYTICAL_ABILITY", "FOCUS", "CREATIVITY", "PATIENCE", "MEMORY"} |
This file contains 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
unit = dfhack.gui.getSelectedUnit() | |
PlusPlus = {700, 1200, 1400, 1500, 1600, 1800, 2500} | |
Plus = {450, 950, 1150, 1250, 1350, 1550, 2250} | |
Normal = {200, 700, 900, 1000, 1100, 1300, 2000} | |
Minus = {150, 600, 800, 900, 1000, 1100, 1500} | |
Mental_Attribute_Names = { | |
Mental_PlusPlus = {"FOCUS", "SPATIAL_SENSE"}, | |
Mental_Plus = {"ANALYTICAL_ABILITY", "FOCUS", "CREATIVITY", "PATIENCE", "MEMORY"}, |
This file contains 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
-- Bugs | |
--[[ | |
...rk\MasterworkDF v3e\Dwarf Fortress\hack\scripts/test.lua:199: Cannot read fie | |
ld unit_attribute[].6: index out of bounds. | |
stack traceback: | |
[C]: in function '__index' | |
...rk\MasterworkDF v3e\Dwarf Fortress\hack\scripts/test.lua:199: in func | |
tion 'boostValue' | |
...rk\MasterworkDF v3e\Dwarf Fortress\hack\scripts/test.lua:61: in funct |
This file contains 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
-- Bugs | |
-- -------------------------------------------------------------------------- | |
-- Functions | |
function boostAttributes(selectedUnitCaste, unit) | |
--[[ these were not easy to get, see code... | |
df.physical_attribute_type | |
0 STRENGTH | |
1 AGILITY |
This file contains 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
-- Bugs | |
-- -------------------------------------------------------------------------- | |
-- Classes | |
TraitArrayBins = defclass(TraitArrayBins) | |
TraitArrayBins.ATTR = { | |
name = "", | |
traitMin = 0, | |
traitMed = 0, | |
traitMax = 0 |
This file contains 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
TraitArrayBins = {} | |
TraitArrayBins.__index = TraitArrayBins | |
function TraitArrayBins.create(name, traitMin, traitMed, traitMax) | |
local trait = {} | |
setmetatable(trait,TraitArrayBins) | |
trait.name = name | |
trait.traitMin = traitMin |
This file contains 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 os | |
os.environ['R_HOME'] = '/mnt/distvol/R/4.0.5/lib64/R/' | |
import rpy2.robjects as ro | |
from rpy2.robjects.packages import importr | |
from rpy2.robjects import pandas2ri | |
pandas2ri.activate() | |
k = 4 | |
grdevices = importr('grDevices') |
This file contains 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 sklearn | |
from sklearn.feature_extraction.text import TfidfVectorizer | |
from sklearn.model_selection import train_test_split | |
import numpy as np | |
import shap | |
shap.initjs() | |
# select a set of background examples to take an expectation over | |
background = np.array(data) | |
#[np.random.choice(X_train.shape[0],100,replace=False)] |
This file contains 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
trf = zca.ZCA().fit(transformed.iloc[:,1:]) | |
X = pd.DataFrame(trf.transform(transformed.iloc[:,1:])) | |
X.columns=pd.DataFrame(transformed.iloc[:,1:]).columns | |
X.index = all_data.index | |
#from sklearn.preprocessing import StandardScaler | |
y = pd.DataFrame((transformed.iloc[:,0]-np.mean(transformed.iloc[:,0]))/np.std(transformed.iloc[:,0])) | |
y.columns=pd.DataFrame(transformed.iloc[:,0]).columns | |
y.index = all_data.index |
This file contains 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
converted = pd.DataFrame() | |
def ecdf2(values): | |
co = len(values) | |
externalArray = pd.DataFrame() | |
for d in range(0,len(values.columns)): | |
internalArray = [] | |
for i in range(0,len(values.iloc[:,d])): | |
a = ( \ | |
sum( ( values.iloc[:,d] <= values.iloc[:,d][i] ) ) + \ |
OlderNewer