neurostatx.cli.LogisticRegression
Attributes
| Name | Description |
|---|---|
app | Cyclopts application for the LogisticRegression command-line tool. |
Functions
| Name | Description |
|---|---|
LogisticRegression | Fit logistic regression of graph edges against node attributes. |
appattributemodule attribute#
app = App(default_parameter=Parameter(negative=()))Cyclopts application for the LogisticRegression command-line tool.
LogisticRegressionfunction#
def LogisticRegression(in_graph: Annotated[str, Parameter(show_default=False, group='Essential Files Options')], out_folder: Annotated[str, Parameter(show_default=False, group='Essential Files Options')], attributes: Annotated[List[str], Parameter(group='Model Parameters', show_default=False)], covariates: Annotated[List[str], Parameter(group='Model Parameters', show_default=True)] = None, weight: Annotated[str, Parameter(group='Model Parameters', show_default=True)] = 'membership', splits: Annotated[int, Parameter(group='Model Parameters', show_default=True)] = 10, test_size: Annotated[float, Parameter(group='Model Parameters', show_default=True)] = 0.2, cs: Annotated[int, Parameter(group='Model Parameters', show_default=True)] = 10, max_iter: Annotated[int, Parameter(group='Model Parameters', show_default=True)] = 1000, penalty: Annotated[Penalty, Parameter(group='Model Parameters', show_default=True, show_choices=True)] = Penalty.l2, solver: Annotated[Solver, Parameter(group='Model Parameters', show_default=True, show_choices=True)] = Solver.lbfgs, permutations: Annotated[int, Parameter(group='Model Parameters', show_default=True)] = 1000, scoring: Annotated[ScoringMethod, Parameter(group='Model Parameters', show_default=True)] = ScoringMethod.r2, processes: Annotated[int, Parameter(group='Model Parameters', show_default=True)] = 1, plot_distributions: Annotated[bool, Parameter(show_default=True, group='Visualization Options')] = False, verbose: Annotated[bool, Parameter(-v, --verbose, group='Optional parameters')] = False, save_parameters: Annotated[bool, Parameter(-s, --save_parameters, group='Optional parameters')] = False, overwrite: Annotated[bool, Parameter(-f, --overwrite, group='Optional parameters')] = False)Fit logistic regression of graph edges against node attributes.
LogisticRegression uses edge weights as predictors and node attributes as the response. It cross-validates on a training set, tests on held-out data, then runs permutation testing for statistical significance. It writes coefficients, statistics, and plots of attribute and edge-weight distributions and of the coefficients.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
in_graph | str | required | Graph file containing the data for the model. |
out_folder | str | required | Output folder. |
attributes | List[str] | required | Attribute names to include in the model. Must be present in the graph file. At least one attribute is required. |
covariates | List[str] | None | Covariates to include in the model. Must be present in the graph file. Defaults to None. |
weight | str | 'membership' | Edge weight to use for the model. Defaults to membership. |
splits | int | 10 | Number of splits to use for the cross-validation. Defaults to 10. |
test_size | float | 0.2 | Size of the testing set. Must be between 0 and 1. Defaults to 0.2. |
cs | int | 10 | Inverse of regularization strength. Smaller values specify stronger regularization. Defaults to 10. |
max_iter | int | 1000 | Maximum number of iterations for the solver. Defaults to 1000. |
penalty | Penalty | Penalty.l2 | Regularization penalty to use for the LogisticRegression model. Defaults to l2. |
solver | Solver | Solver.lbfgs | Solver to use for the LogisticRegression model. Defaults to lbfgs. |
permutations | int | 1000 | Number of permutations to use for the permutation testing. Defaults to 1000. |
scoring | ScoringMethod | ScoringMethod.r2 | Scoring method to use for the permutation testing. Defaults to r2. |
processes | int | 1 | Number of processes to use for the cross-validation. Defaults to 1. |
plot_distributions | bool | False | If true, will plot the distributions of the edges’ weights. Defaults to False. |
verbose | bool | False | If true, produce verbose output. Defaults to False. |
save_parameters | bool | False | If true, will save input parameters to .txt file. Defaults to False. |
overwrite | bool | False | If true, force overwriting of existing output files. Defaults to False. |
Examples
LogisticRegression --in-graph graph.gexf --out-folder output_folder -v-s