prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  p_value_ inconsistency between latent distribution and latent position tests
  [after the #336,] latent distribution test has attribute self.p_value_, whereas latent position test has self.p_ . they should be made consistent. specifically, change latent position test to p_value_.
  
  </issue>
  <code>
  [start of graspy/inference/base.py]
  1 # Copyright 2019 NeuroData (http://neurodata.io)
  2 #
  3 # Licensed under the Apache License, Version 2.0 (the "License");
  4 # you may not use this file except in compliance with the License.
  5 # You may obtain a copy of the License at
  6 #
  7 #     http://www.apache.org/licenses/LICENSE-2.0
  8 #
  9 # Unless required by applicable law or agreed to in writing, software
  10 # distributed under the License is distributed on an "AS IS" BASIS,
  11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12 # See the License for the specific language governing permissions and
  13 # limitations under the License.
  14 
  15 from abc import abstractmethod
  16 from sklearn.base import BaseEstimator
  17 import numpy as np
  18 
  19 
  20 class BaseInference(BaseEstimator):
  21     """
  22     Base class for inference tasks such as semiparametric and
  23     nonparametric inference tasks.
  24 
  25     Parameters
  26     ----------
  27     embedding : { 'ase' (default), 'lse, 'omnibus'}
  28         String describing the embedding method to use.
  29         Must be one of:
  30         'ase'
  31             Embed each graph separately using adjacency spectral embedding
  32             and use Procrustes to align the embeddings.
  33         'omnibus'
  34             Embed all graphs simultaneously using omnibus embedding.
  35 
  36     n_components : None (default), or int
  37         Number of embedding dimensions. If None, the optimal embedding
  38         dimensions are found by the Zhu and Godsi algorithm.
  39     """
  40 
  41     def __init__(self, embedding="ase", n_components=None):
  42         if type(embedding) is not str:
  43             raise TypeError("embedding must be str")
  44         if (not isinstance(n_components, (int, np.integer))) and (
  45             n_components is not None
  46         ):
  47             raise TypeError("n_components must be int or np.integer")
  48         if embedding not in ["ase", "omnibus"]:
  49             raise ValueError("{} is not a valid embedding method.".format(embedding))
  50         if n_components is not None and n_components <= 0:
  51             raise ValueError(
  52                 "Cannot embed into {} dimensions, must be greater than 0".format(
  53                     n_components
  54                 )
  55             )
  56         self.embedding = embedding
  57         self.n_components = n_components
  58 
  59     @abstractmethod
  60     def _bootstrap(self):
  61         pass
  62 
  63     @abstractmethod
  64     def _embed(self, X1, X2, n_componets):
  65         """
  66         Computes the latent positions of input graphs
  67 
  68         Returns
  69         -------
  70         X1_hat : array-like, shape (n_vertices, n_components)
  71             Estimated latent positions of X1
  72         X2_hat : array-like, shape(n_vertices, n_components)
  73             Estimated latent positions of X2
  74         """
  75 
  76     @abstractmethod
  77     def fit(self, A1, A2):
  78         """
  79         Compute the test statistic and the null distribution.
  80 
  81         Parameters
  82         ----------
  83         X1 : nx.Graph or np.ndarray
  84             A graph
  85         X2 : nx.Graph or np.ndarray
  86             A graph
  87         """
  88
  [end of graspy/inference/base.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/graspy/inference/base.py b/graspy/inference/base.py
  --- a/graspy/inference/base.py
  +++ b/graspy/inference/base.py
  @@ -12,65 +12,54 @@
   # See the License for the specific language governing permissions and
   # limitations under the License.
   
  +import numpy as np
   from abc import abstractmethod
   from sklearn.base import BaseEstimator
  -import numpy as np
   
   
   class BaseInference(BaseEstimator):
       """
  -    Base class for inference tasks such as semiparametric and
  -    nonparametric inference tasks.
  +    Base class for inference tasks such as semiparametric latent position test
  +    and nonparametric latent distribution test.
   
       Parameters
       ----------
  -    embedding : { 'ase' (default), 'lse, 'omnibus'}
  -        String describing the embedding method to use.
  -        Must be one of:
  -        'ase'
  -            Embed each graph separately using adjacency spectral embedding
  -            and use Procrustes to align the embeddings.
  -        'omnibus'
  -            Embed all graphs simultaneously using omnibus embedding.
  -
       n_components : None (default), or int
           Number of embedding dimensions. If None, the optimal embedding
  -        dimensions are found by the Zhu and Godsi algorithm.
  +        dimensions are chosen via the Zhu and Godsi algorithm.
       """
   
  -    def __init__(self, embedding="ase", n_components=None):
  -        if type(embedding) is not str:
  -            raise TypeError("embedding must be str")
  +    def __init__(self, n_components=None):
           if (not isinstance(n_components, (int, np.integer))) and (
               n_components is not None
           ):
               raise TypeError("n_components must be int or np.integer")
  -        if embedding not in ["ase", "omnibus"]:
  -            raise ValueError("{} is not a valid embedding method.".format(embedding))
           if n_components is not None and n_components <= 0:
               raise ValueError(
                   "Cannot embed into {} dimensions, must be greater than 0".format(
                       n_components
                   )
               )
  -        self.embedding = embedding
           self.n_components = n_components
   
       @abstractmethod
  -    def _bootstrap(self):
  -        pass
  -
  -    @abstractmethod
  -    def _embed(self, X1, X2, n_componets):
  +    def _embed(self, A1, A2, n_componets):
           """
           Computes the latent positions of input graphs
   
  +        Parameters
  +        ----------
  +        A1 : np.ndarray, shape (n_vertices, n_vertices)
  +            Adjacency matrix of the first graph
  +        A2 : np.ndarray, shape (n_vertices, n_vertices)
  +            Adjacency matrix of the second graph
  +
           Returns
           -------
           X1_hat : array-like, shape (n_vertices, n_components)
  -            Estimated latent positions of X1
  +            Estimated latent positions of the vertices in the first graph
           X2_hat : array-like, shape(n_vertices, n_components)
  -            Estimated latent positions of X2
  +            Estimated latent positions of the vertices in the second graph
           """
   
       @abstractmethod
  @@ -80,8 +69,31 @@
   
           Parameters
           ----------
  -        X1 : nx.Graph or np.ndarray
  -            A graph
  -        X2 : nx.Graph or np.ndarray
  -            A graph
  +        A1, A2 : nx.Graph, nx.DiGraph, nx.MultiDiGraph, nx.MultiGraph, np.ndarray
  +            The two graphs to run a hypothesis test on.
  +            If np.ndarray, shape must be ``(n_vertices, n_vertices)`` for both
  +            graphs, where ``n_vertices`` is the same for both
  +
  +        Returns
  +        ------
  +        self
  +        """
  +        pass
  +
  +    def fit_predict(self, A1, A2):
  +        """
  +        Fits the model and returns the p-value
  +        Parameters
  +        ----------
  +        A1, A2 : nx.Graph, nx.DiGraph, nx.MultiDiGraph, nx.MultiGraph, np.ndarray
  +            The two graphs to run a hypothesis test on.
  +            If np.ndarray, shape must be ``(n_vertices, n_vertices)`` for both
  +            graphs, where ``n_vertices`` is the same for both
  +
  +        Returns
  +        ------
  +        p_value_ : float
  +            The overall p value from the test
           """
  +        self.fit(A1, A2)
  +        return self.p_value_
  
verification_info: {"golden_diff": "diff --git a/graspy/inference/base.py b/graspy/inference/base.py\n--- a/graspy/inference/base.py\n+++ b/graspy/inference/base.py\n@@ -12,65 +12,54 @@\n # See the License for the specific language governing permissions and\n # limitations under the License.\n \n+import numpy as np\n from abc import abstractmethod\n from sklearn.base import BaseEstimator\n-import numpy as np\n \n \n class BaseInference(BaseEstimator):\n     \"\"\"\n-    Base class for inference tasks such as semiparametric and\n-    nonparametric inference tasks.\n+    Base class for inference tasks such as semiparametric latent position test\n+    and nonparametric latent distribution test.\n \n     Parameters\n     ----------\n-    embedding : { 'ase' (default), 'lse, 'omnibus'}\n-        String describing the embedding method to use.\n-        Must be one of:\n-        'ase'\n-            Embed each graph separately using adjacency spectral embedding\n-            and use Procrustes to align the embeddings.\n-        'omnibus'\n-            Embed all graphs simultaneously using omnibus embedding.\n-\n     n_components : None (default), or int\n         Number of embedding dimensions. If None, the optimal embedding\n-        dimensions are found by the Zhu and Godsi algorithm.\n+        dimensions are chosen via the Zhu and Godsi algorithm.\n     \"\"\"\n \n-    def __init__(self, embedding=\"ase\", n_components=None):\n-        if type(embedding) is not str:\n-            raise TypeError(\"embedding must be str\")\n+    def __init__(self, n_components=None):\n         if (not isinstance(n_components, (int, np.integer))) and (\n             n_components is not None\n         ):\n             raise TypeError(\"n_components must be int or np.integer\")\n-        if embedding not in [\"ase\", \"omnibus\"]:\n-            raise ValueError(\"{} is not a valid embedding method.\".format(embedding))\n         if n_components is not None and n_components <= 0:\n             raise ValueError(\n                 \"Cannot embed into {} dimensions, must be greater than 0\".format(\n                     n_components\n                 )\n             )\n-        self.embedding = embedding\n         self.n_components = n_components\n \n     @abstractmethod\n-    def _bootstrap(self):\n-        pass\n-\n-    @abstractmethod\n-    def _embed(self, X1, X2, n_componets):\n+    def _embed(self, A1, A2, n_componets):\n         \"\"\"\n         Computes the latent positions of input graphs\n \n+        Parameters\n+        ----------\n+        A1 : np.ndarray, shape (n_vertices, n_vertices)\n+            Adjacency matrix of the first graph\n+        A2 : np.ndarray, shape (n_vertices, n_vertices)\n+            Adjacency matrix of the second graph\n+\n         Returns\n         -------\n         X1_hat : array-like, shape (n_vertices, n_components)\n-            Estimated latent positions of X1\n+            Estimated latent positions of the vertices in the first graph\n         X2_hat : array-like, shape(n_vertices, n_components)\n-            Estimated latent positions of X2\n+            Estimated latent positions of the vertices in the second graph\n         \"\"\"\n \n     @abstractmethod\n@@ -80,8 +69,31 @@\n \n         Parameters\n         ----------\n-        X1 : nx.Graph or np.ndarray\n-            A graph\n-        X2 : nx.Graph or np.ndarray\n-            A graph\n+        A1, A2 : nx.Graph, nx.DiGraph, nx.MultiDiGraph, nx.MultiGraph, np.ndarray\n+            The two graphs to run a hypothesis test on.\n+            If np.ndarray, shape must be ``(n_vertices, n_vertices)`` for both\n+            graphs, where ``n_vertices`` is the same for both\n+\n+        Returns\n+        ------\n+        self\n+        \"\"\"\n+        pass\n+\n+    def fit_predict(self, A1, A2):\n+        \"\"\"\n+        Fits the model and returns the p-value\n+        Parameters\n+        ----------\n+        A1, A2 : nx.Graph, nx.DiGraph, nx.MultiDiGraph, nx.MultiGraph, np.ndarray\n+            The two graphs to run a hypothesis test on.\n+            If np.ndarray, shape must be ``(n_vertices, n_vertices)`` for both\n+            graphs, where ``n_vertices`` is the same for both\n+\n+        Returns\n+        ------\n+        p_value_ : float\n+            The overall p value from the test\n         \"\"\"\n+        self.fit(A1, A2)\n+        return self.p_value_\n", "issue": "p_value_ inconsistency between latent distribution and latent position tests\n[after the #336,] latent distribution test has attribute self.p_value_, whereas latent position test has self.p_ . they should be made consistent. specifically, change latent position test to p_value_.\n", "before_files": [{"content": "# Copyright 2019 NeuroData (http://neurodata.io)\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nfrom abc import abstractmethod\nfrom sklearn.base import BaseEstimator\nimport numpy as np\n\n\nclass BaseInference(BaseEstimator):\n    \"\"\"\n    Base class for inference tasks such as semiparametric and\n    nonparametric inference tasks.\n\n    Parameters\n    ----------\n    embedding : { 'ase' (default), 'lse, 'omnibus'}\n        String describing the embedding method to use.\n        Must be one of:\n        'ase'\n            Embed each graph separately using adjacency spectral embedding\n            and use Procrustes to align the embeddings.\n        'omnibus'\n            Embed all graphs simultaneously using omnibus embedding.\n\n    n_components : None (default), or int\n        Number of embedding dimensions. If None, the optimal embedding\n        dimensions are found by the Zhu and Godsi algorithm.\n    \"\"\"\n\n    def __init__(self, embedding=\"ase\", n_components=None):\n        if type(embedding) is not str:\n            raise TypeError(\"embedding must be str\")\n        if (not isinstance(n_components, (int, np.integer))) and (\n            n_components is not None\n        ):\n            raise TypeError(\"n_components must be int or np.integer\")\n        if embedding not in [\"ase\", \"omnibus\"]:\n            raise ValueError(\"{} is not a valid embedding method.\".format(embedding))\n        if n_components is not None and n_components <= 0:\n            raise ValueError(\n                \"Cannot embed into {} dimensions, must be greater than 0\".format(\n                    n_components\n                )\n            )\n        self.embedding = embedding\n        self.n_components = n_components\n\n    @abstractmethod\n    def _bootstrap(self):\n        pass\n\n    @abstractmethod\n    def _embed(self, X1, X2, n_componets):\n        \"\"\"\n        Computes the latent positions of input graphs\n\n        Returns\n        -------\n        X1_hat : array-like, shape (n_vertices, n_components)\n            Estimated latent positions of X1\n        X2_hat : array-like, shape(n_vertices, n_components)\n            Estimated latent positions of X2\n        \"\"\"\n\n    @abstractmethod\n    def fit(self, A1, A2):\n        \"\"\"\n        Compute the test statistic and the null distribution.\n\n        Parameters\n        ----------\n        X1 : nx.Graph or np.ndarray\n            A graph\n        X2 : nx.Graph or np.ndarray\n            A graph\n        \"\"\"\n", "path": "graspy/inference/base.py"}]}