Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CompStats/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
__version__ = '0.1.9'
__version__ = '0.1.10'
from CompStats.bootstrap import StatisticSamples
from CompStats.measurements import CI, SE, difference_p_value
from CompStats.performance import performance, difference, all_differences, plot_performance, plot_difference
Expand Down
11 changes: 6 additions & 5 deletions CompStats/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ def __repr__(self):
desc_se = [f'{k:0.4f}' for k in self.se]
desc_se = ', '.join(desc_se)
return f"<{self.__class__.__name__}({arg}={func_name}, statistic=[{desc}], se=[{desc_se}])>"

def __str__(self):
"""Prediction statistics with standard error in parenthesis"""
if not isinstance(self.statistic, dict):
Expand Down Expand Up @@ -358,10 +358,11 @@ def plot(self, value_name:str=None,
>>> perf.plot()
"""
import seaborn as sns
if self.score_func is not None:
value_name = 'Score'
else:
value_name = 'Error'
if value_name is None:
if self.score_func is not None:
value_name = 'Score'
else:
value_name = 'Error'
df = self.dataframe(value_name=value_name, var_name=var_name,
alg_legend=alg_legend, perf_names=perf_names)
if var_name not in df.columns:
Expand Down
13 changes: 8 additions & 5 deletions CompStats/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,18 @@ def dataframe(instance, value_name:str='Score',
perf_names:list=None):
"""Dataframe"""
import pandas as pd
statistic = instance.statistic
if not isinstance(statistic, dict):
iter = instance.statistic_samples.keys()
else:
iter = statistic
if isinstance(instance.best, str):
df = pd.DataFrame(dict(instance.statistic_samples.calls.items()))
calls = instance.statistic_samples.calls
df = pd.DataFrame({k: calls[k]
for k in iter if k in calls})
return df.melt(var_name=alg_legend,
value_name=value_name)
df = pd.DataFrame()
if not isinstance(instance.statistic, dict):
iter = instance.statistic_samples.keys()
else:
iter = instance.statistic
for key in iter:
data = instance.statistic_samples[key]
_df = pd.DataFrame(data,
Expand Down
Loading