Skip to content
This repository was archived by the owner on Oct 21, 2025. It is now read-only.

Commit 974b482

Browse files
Merge pull request #192 from theislab/correct_constraint_doc
Correct constraint doc
2 parents c94e60a + 6ac7ac6 commit 974b482

File tree

3 files changed

+57
-45
lines changed

3 files changed

+57
-45
lines changed

diffxpy/fit/fit.py

Lines changed: 32 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,10 @@ def model(
8080
:param constraints_loc: Constraints for location model. Can be one of the following:
8181
8282
- np.ndarray:
83-
Array with constraints in rows and model parameters in columns.
84-
Each constraint contains non-zero entries for the a of parameters that
85-
has to sum to zero. This constraint is enforced by binding one parameter
83+
Array with constraints in columns and model parameters in rows.
84+
Each constraint contains non-zero entries for the constrained parameters that
85+
have to sum to zero. For a non-constrained parameter the revelant constraint column
86+
contains 1 in the parameter row. This constraint is enforced by binding one parameter
8687
to the negative sum of the other parameters, effectively representing that
8788
parameter as a function of the other parameters. This dependent
8889
parameter is indicated by a -1 in this array, the independent parameters
@@ -113,9 +114,10 @@ def model(
113114
:param constraints_scale: Constraints for scale model. Can be one of the following:
114115
115116
- np.ndarray:
116-
Array with constraints in rows and model parameters in columns.
117-
Each constraint contains non-zero entries for the a of parameters that
118-
has to sum to zero. This constraint is enforced by binding one parameter
117+
Array with constraints in columns and model parameters in rows.
118+
Each constraint contains non-zero entries for the constrained parameters that
119+
have to sum to zero. For a non-constrained parameter the revelant constraint column
120+
contains 1 in the parameter row. This constraint is enforced by binding one parameter
119121
to the negative sum of the other parameters, effectively representing that
120122
parameter as a function of the other parameters. This dependent
121123
parameter is indicated by a -1 in this array, the independent parameters
@@ -291,9 +293,10 @@ def residuals(
291293
:param constraints_loc: Constraints for location model. Can be one of the following:
292294
293295
- np.ndarray:
294-
Array with constraints in rows and model parameters in columns.
295-
Each constraint contains non-zero entries for the a of parameters that
296-
has to sum to zero. This constraint is enforced by binding one parameter
296+
Array with constraints in columns and model parameters in rows.
297+
Each constraint contains non-zero entries for the constrained parameters that
298+
have to sum to zero. For a non-constrained parameter the revelant constraint column
299+
contains 1 in the parameter row. This constraint is enforced by binding one parameter
297300
to the negative sum of the other parameters, effectively representing that
298301
parameter as a function of the other parameters. This dependent
299302
parameter is indicated by a -1 in this array, the independent parameters
@@ -324,9 +327,10 @@ def residuals(
324327
:param constraints_scale: Constraints for scale model. Can be one of the following:
325328
326329
- np.ndarray:
327-
Array with constraints in rows and model parameters in columns.
328-
Each constraint contains non-zero entries for the a of parameters that
329-
has to sum to zero. This constraint is enforced by binding one parameter
330+
Array with constraints in columns and model parameters in rows.
331+
Each constraint contains non-zero entries for the constrained parameters that
332+
have to sum to zero. For a non-constrained parameter the revelant constraint column
333+
contains 1 in the parameter row. This constraint is enforced by binding one parameter
330334
to the negative sum of the other parameters, effectively representing that
331335
parameter as a function of the other parameters. This dependent
332336
parameter is indicated by a -1 in this array, the independent parameters
@@ -550,9 +554,10 @@ def model(
550554
:param constraints_loc: Constraints for location model. Can be one of the following:
551555
552556
- np.ndarray:
553-
Array with constraints in rows and model parameters in columns.
554-
Each constraint contains non-zero entries for the a of parameters that
555-
has to sum to zero. This constraint is enforced by binding one parameter
557+
Array with constraints in columns and model parameters in rows.
558+
Each constraint contains non-zero entries for the constrained parameters that
559+
have to sum to zero. For a non-constrained parameter the revelant constraint column
560+
contains 1 in the parameter row. This constraint is enforced by binding one parameter
556561
to the negative sum of the other parameters, effectively representing that
557562
parameter as a function of the other parameters. This dependent
558563
parameter is indicated by a -1 in this array, the independent parameters
@@ -583,9 +588,10 @@ def model(
583588
:param constraints_scale: Constraints for scale model. Can be one of the following:
584589
585590
- np.ndarray:
586-
Array with constraints in rows and model parameters in columns.
587-
Each constraint contains non-zero entries for the a of parameters that
588-
has to sum to zero. This constraint is enforced by binding one parameter
591+
Array with constraints in columns and model parameters in rows.
592+
Each constraint contains non-zero entries for the constrained parameters that
593+
have to sum to zero. For a non-constrained parameter the revelant constraint column
594+
contains 1 in the parameter row. This constraint is enforced by binding one parameter
589595
to the negative sum of the other parameters, effectively representing that
590596
parameter as a function of the other parameters. This dependent
591597
parameter is indicated by a -1 in this array, the independent parameters
@@ -707,9 +713,10 @@ def residuals(
707713
:param constraints_loc: Constraints for location model. Can be one of the following:
708714
709715
- np.ndarray:
710-
Array with constraints in rows and model parameters in columns.
711-
Each constraint contains non-zero entries for the a of parameters that
712-
has to sum to zero. This constraint is enforced by binding one parameter
716+
Array with constraints in columns and model parameters in rows.
717+
Each constraint contains non-zero entries for the constrained parameters that
718+
have to sum to zero. For a non-constrained parameter the revelant constraint column
719+
contains 1 in the parameter row. This constraint is enforced by binding one parameter
713720
to the negative sum of the other parameters, effectively representing that
714721
parameter as a function of the other parameters. This dependent
715722
parameter is indicated by a -1 in this array, the independent parameters
@@ -740,9 +747,10 @@ def residuals(
740747
:param constraints_scale: Constraints for scale model. Can be one of the following:
741748
742749
- np.ndarray:
743-
Array with constraints in rows and model parameters in columns.
744-
Each constraint contains non-zero entries for the a of parameters that
745-
has to sum to zero. This constraint is enforced by binding one parameter
750+
Array with constraints in columns and model parameters in rows.
751+
Each constraint contains non-zero entries for the constrained parameters that
752+
have to sum to zero. For a non-constrained parameter the revelant constraint column
753+
contains 1 in the parameter row. This constraint is enforced by binding one parameter
746754
to the negative sum of the other parameters, effectively representing that
747755
parameter as a function of the other parameters. This dependent
748756
parameter is indicated by a -1 in this array, the independent parameters

diffxpy/testing/tests.py

Lines changed: 24 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -52,18 +52,20 @@ def _fit(
5252
:param design_loc: Design matrix of location model.
5353
:param design_loc: Design matrix of scale model.
5454
:param constraints_loc: : Constraints for location model.
55-
Array with constraints in rows and model parameters in columns.
56-
Each constraint contains non-zero entries for the a of parameters that
57-
has to sum to zero. This constraint is enforced by binding one parameter
55+
Array with constraints in columns and model parameters in rows.
56+
Each constraint contains non-zero entries for the constrained parameters that
57+
have to sum to zero. For a non-constrained parameter the revelant constraint column
58+
contains 1 in the parameter row. This constraint is enforced by binding one parameter
5859
to the negative sum of the other parameters, effectively representing that
5960
parameter as a function of the other parameters. This dependent
6061
parameter is indicated by a -1 in this array, the independent parameters
6162
of that constraint (which may be dependent at an earlier constraint)
6263
are indicated by a 1.
6364
:param constraints_scale: : Constraints for scale model.
64-
Array with constraints in rows and model parameters in columns.
65-
Each constraint contains non-zero entries for the a of parameters that
66-
has to sum to zero. This constraint is enforced by binding one parameter
65+
Array with constraints in columns and model parameters in rows.
66+
Each constraint contains non-zero entries for the constrained parameters that
67+
have to sum to zero. For a non-constrained parameter the revelant constraint column
68+
contains 1 in the parameter row. This constraint is enforced by binding one parameter
6769
to the negative sum of the other parameters, effectively representing that
6870
parameter as a function of the other parameters. This dependent
6971
parameter is indicated by a -1 in this array, the independent parameters
@@ -519,9 +521,10 @@ def wald(
519521
:param constraints_loc: Constraints for location model. Can be one of the following:
520522
521523
- np.ndarray:
522-
Array with constraints in rows and model parameters in columns.
523-
Each constraint contains non-zero entries for the a of parameters that
524-
has to sum to zero. This constraint is enforced by binding one parameter
524+
Array with constraints in columns and model parameters in rows.
525+
Each constraint contains non-zero entries for the constrained parameters that
526+
have to sum to zero. For a non-constrained parameter the revelant constraint column
527+
contains 1 in the parameter row. This constraint is enforced by binding one parameter
525528
to the negative sum of the other parameters, effectively representing that
526529
parameter as a function of the other parameters. This dependent
527530
parameter is indicated by a -1 in this array, the independent parameters
@@ -552,9 +555,10 @@ def wald(
552555
:param constraints_scale: Constraints for scale model. Can be one of the following:
553556
554557
- np.ndarray:
555-
Array with constraints in rows and model parameters in columns.
556-
Each constraint contains non-zero entries for the a of parameters that
557-
has to sum to zero. This constraint is enforced by binding one parameter
558+
Array with constraints in columns and model parameters in rows.
559+
Each constraint contains non-zero entries for the constrained parameters that
560+
have to sum to zero. For a non-constrained parameter the revelant constraint column
561+
contains 1 in the parameter row. This constraint is enforced by binding one parameter
558562
to the negative sum of the other parameters, effectively representing that
559563
parameter as a function of the other parameters. This dependent
560564
parameter is indicated by a -1 in this array, the independent parameters
@@ -1896,19 +1900,21 @@ def wald(
18961900
This makes sense for number of genes, time, pseudotime or space
18971901
for example.
18981902
:param constraints_loc: : Constraints for location model.
1899-
Array with constraints in rows and model parameters in columns.
1900-
Each constraint contains non-zero entries for the a of parameters that
1901-
has to sum to zero. This constraint is enforced by binding one parameter
1903+
Array with constraints in columns and model parameters in rows.
1904+
Each constraint contains non-zero entries for the constrained parameters that
1905+
have to sum to zero. For a non-constrained parameter the revelant constraint column
1906+
contains 1 in the parameter row. This constraint is enforced by binding one parameter
19021907
to the negative sum of the other parameters, effectively representing that
19031908
parameter as a function of the other parameters. This dependent
19041909
parameter is indicated by a -1 in this array, the independent parameters
19051910
of that constraint (which may be dependent at an earlier constraint)
19061911
are indicated by a 1. It is highly recommended to only use this option
19071912
together with prebuilt design matrix for the location model, dmat_loc.
19081913
:param constraints_scale: : Constraints for scale model.
1909-
Array with constraints in rows and model parameters in columns.
1910-
Each constraint contains non-zero entries for the a of parameters that
1911-
has to sum to zero. This constraint is enforced by binding one parameter
1914+
Array with constraints in columns and model parameters in rows.
1915+
Each constraint contains non-zero entries for the constrained parameters that
1916+
have to sum to zero. For a non-constrained parameter the revelant constraint column
1917+
contains 1 in the parameter row. This constraint is enforced by binding one parameter
19121918
to the negative sum of the other parameters, effectively representing that
19131919
parameter as a function of the other parameters. This dependent
19141920
parameter is indicated by a -1 in this array, the independent parameters

docs/tutorials.rst

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,7 @@ Diffxpy allows you to define a data set partition and to conduct test on each ge
3636
Multiple tests per gene
3737
~~~~~~~~~~~~~~~~~~~~~~~
3838

39-
How to perform `pairwise <https://nbviewer.jupyter.org/github/theislab/diffxpy_tutorials/tree/master/diffxpy_tutorials/test/multiple_tests_per_gene.ipynb>`__ tests.
40-
41-
How to perform group tests versus all other groups (versus `rest <https://nbviewer.jupyter.org/github/theislab/diffxpy_tutorials/tree/master/diffxpy_tutorials/test/multiversus_rest.ipynb>`__).
39+
How to perform `pairwise tests, group versus rest tests and tests within each parition <https://nbviewer.jupyter.org/github/theislab/diffxpy_tutorials/tree/master/diffxpy_tutorials/test/multiple_tests_per_gene.ipynb>`__ tests.
4240

4341

4442
Gene set enrichment: enrich

0 commit comments

Comments
 (0)