diff --git a/website/docs/Quick-Start.md b/website/docs/Quick-Start.md index 10f725bb..d8a19fe2 100644 --- a/website/docs/Quick-Start.md +++ b/website/docs/Quick-Start.md @@ -44,31 +44,23 @@ class BasicConfig: most_fancy_parameter: List[int] ``` -Next let's add two simple function(s) to our script. They both so the same thing but use our parameters in two different -ways. +Next let's add a simple function to our script. The function takes as an argument a `Spockspace` (in this case we type +hint within Python so IDEs can autocomplete), thus we access our defined parameters from the class definition above via +dot notation (just like `Namespaces` as the output from argparsers). ```python -def add_namespace(config): +def add_values(config: BasicConfig): # Lets just do some basic algebra here val_sum = sum([(config.fancy_parameter * val) + config.fancier_parameter for val in config.most_fancy_parameter]) # If the boolean is true let's round if config.parameter: val_sum = round(val_sum) return val_sum - -def add_by_parameter(multiply_param, list_vals, add_param, tf_round): - # Lets just do some basic algebra here - val_sum = sum([(multiply_param * val) + add_param for val in list_vals]) - # If the boolean is true let's round - if tf_round: - val_sum = round(val_sum) - return val_sum ``` Now, we build out the parameter objects by passing in the `spock` objects (as `*args`) to the `SpockBuilder` -and chain call the `generate` method. The returned namespace object contains the defined classes named with the given -`spock` class name. We then can pass the whole object to our first function or specific parameters to our -second function. +and chain call the `generate` method. The returned object contains the defined classes named with the given +`spock` class name which we call a `Spockspace`. We then simply pass `config.BasicConfig` to our function. ```python def main(): @@ -77,12 +69,8 @@ def main(): # One can now access the Spock config object by class name with the returned namespace print(config.BasicConfig.parameter) # And pass the namespace to our first function - val_sum_namespace = add_namespace(config.BasicConfig) + val_sum_namespace = add_values(config.BasicConfig) print(val_sum_namespace) - # Or pass by parameter - val_sum_parameter = add_by_parameter(config.BasicConfig.fancy_parameter, config.BasicConfig.most_fancy_parameter, - config.BasicConfig.fancier_parameter, config.BasicConfig.parameter) - print(val_sum_parameter) if __name__ == '__main__': diff --git a/website/docs/addons/tuner/Basics.md b/website/docs/addons/tuner/Basics.md index 1b168077..b6eeb818 100644 --- a/website/docs/addons/tuner/Basics.md +++ b/website/docs/addons/tuner/Basics.md @@ -56,7 +56,7 @@ X_train, X_valid, y_train, y_valid = train_test_split(X, y) ``` -The `@spockTuner` decorated classes are passed to the `CSpockBuilder` in the exact same way as basic `@spock` +The `@spockTuner` decorated classes are passed to the `SpockBuilder` in the exact same way as basic `@spock` decorated classes. This returns a `spock` builder object which can be used to call different methods. ```python diff --git a/website/docs/basics/Saving.md b/website/docs/basics/Saving.md index 56df4fb5..5fc9a4b8 100644 --- a/website/docs/basics/Saving.md +++ b/website/docs/basics/Saving.md @@ -108,7 +108,7 @@ def main(): print(config.ModelConfig) ``` -### Does the Directory Exit +### Does the Directory Exist In either case, if the save path does not exist, it will not be created by default. To change this behavior, set `create_save_path` when creating the builder. @@ -139,7 +139,7 @@ def main(): # A simple description description = 'spock Tutorial' # Build out the parser by passing in Spock config objects as *args after description - config = CSpockBuilder(ModelConfig, desc=description).save(file_name='cool_name_here').generate() + config = SpockBuilder(ModelConfig, desc=description).save(file_name='cool_name_here').generate() # One can now access the Spock config object by class name with the returned namespace # For instance... print(config.ModelConfig)