(self, title=None, x_shift=0, start_point=None, plot_interval=None,
                              std_area=False, std_alpha=0.3, show=True, saving_path='.')
plotting the performance curves.

        Parameters
        ----------
        title: str, optioanl (default=None)
            The tile of the figure.

        x_shift: float, optional (default=0)
            The shift value of x_axis.
            For example, the original x_axis is np.arange(0,100,1), x_shift = 1,
            then the new x_axis will be np.arange(1,101,1)

        start_point: float, optional (default=None)
            The value of start point. This value will added before the first data
            point for all methods. If not provided, an infer is attempted.

        plot_interval: float, optional (default=None)
            The interpolate interval in plotting the cost sensitive curves.
            The interpolate is needed because the x_axis is not aligned due to the different cost of labels.
            If not provided, it will use cost_budget/100 as the default interval.

        std_area: bool, optional (default=False)
            Whether to show the std values of the performance after each query.

        std_alpha: float, optional (default=0.3)
            The alpha value of the std shaded area.
            The smaller the value, the lighter the color.

        show: bool, optional (default=True)
            Whether to show the figure.
            If False, it will return the matplotlib.pyplot object directly.

        saving_path: str, optional (default='.')
            The path to save the image.
            Passing None to disable the saving.

        Returns
        -------
        plt: {matplotlib.pyplot, None}
            If passing `show=False`, the matplot object will be returned.
            Else, None will be returned.
plotting the performance curves.
plotting the performance curves .
def plot_learning_curves(self, title=None, x_shift=0, start_point=None, plot_interval=None,
                              std_area=False, std_alpha=0.3, show=True, saving_path='.'):
        """plotting the performance curves.

        Parameters
        ----------
        title: str, optioanl (default=None)
            The tile of the figure.

        x_shift: float, optional (default=0)
            The shift value of x_axis.
            For example, the original x_axis is np.arange(0,100,1), x_shift = 1,
            then the new x_axis will be np.arange(1,101,1)

        start_point: float, optional (default=None)
            The value of start point. This value will added before the first data
            point for all methods. If not provided, an infer is attempted.

        plot_interval: float, optional (default=None)
            The interpolate interval in plotting the cost sensitive curves.
            The interpolate is needed because the x_axis is not aligned due to the different cost of labels.
            If not provided, it will use cost_budget/100 as the default interval.

        std_area: bool, optional (default=False)
            Whether to show the std values of the performance after each query.

        std_alpha: float, optional (default=0.3)
            The alpha value of the std shaded area.
            The smaller the value, the lighter the color.

        show: bool, optional (default=True)
            Whether to show the figure.
            If False, it will return the matplotlib.pyplot object directly.

        saving_path: str, optional (default='.')
            The path to save the image.
            Passing None to disable the saving.

        Returns
        -------
        plt: {matplotlib.pyplot, None}
            If passing `show=False`, the matplot object will be returned.
            Else, None will be returned.
        """
        same, effective_cost, method_cost = self._check_and_get_total_cost()
        interplt_interval = plot_interval if plot_interval is not None else effective_cost / 100

        # plotting
        for i in self._data_extracted.keys():
            # get un-aligned row data
            data_mat = self._data_extracted[i]
            x_axis = [[np.sum(tup[0]) for tup in line] for line in data_mat]
            # calc accumulative cost in x_axis
            for fold_num in range(len(x_axis)):
                ori_data = x_axis[fold_num]
                acc_data = [np.sum(ori_data[0:list_ind+1]) for list_ind in range(len(ori_data))]
                x_axis[fold_num] = acc_data

            y_axis = [[tup[1] for tup in line] for line in data_mat]

            if start_point is None:
                # attempt to infer the start point
                if not self._is_all_stateio or self._data_summary[i].ip is None:
                    pass
                else:
                    for fold_num in range(len(y_axis)):
                        x_axis[fold_num].insert(0, 0)
                        y_axis[fold_num].insert(0, self._data_summary[i].ip)
            else:
                # Use the specified start point
                for fold_num in range(len(y_axis)):
                    x_axis[fold_num].insert(0, 0)
                    y_axis[fold_num].insert(0, start_point)

            # interpolate
            intplt_arr = []
            for fold_num in range(len(x_axis)):  # len(x_axis) == len(y_axis)
                intplt_arr.append(
                    interpolate.interp1d(x=x_axis[fold_num], y=y_axis[fold_num], bounds_error=False, fill_value=0.1))

            new_x_axis = np.arange(max([x[0] for x in x_axis]), effective_cost, interplt_interval)
            new_y_axis = []
            for fold_num in range(len(y_axis)):
                new_y_axis.append(intplt_arr[fold_num](new_x_axis))

            # plot data
            points = np.mean(new_y_axis, axis=0)
            if std_area:
                std_points = np.std(new_y_axis, axis=0)
            plt.plot(new_x_axis + x_shift, points, label=i)
            if std_area:
                plt.fill_between(new_x_axis, points - std_points, points + std_points,
                                 interpolate=True, alpha=std_alpha)

        # axis & title
        plt.legend(fancybox=True, framealpha=0.5)
        plt.xlabel("Cost")
        plt.ylabel("Performance")
        if title is not None:
            plt.title(str(title))

        # saving
        if saving_path is not None:
            saving_path = os.path.abspath(saving_path)
            if os.path.isdir(saving_path):
                try:
                    plt.savefig(os.path.join(saving_path, 'alipy_plotting.jpg'))
                except:
                    plt.savefig(os.path.join(saving_path, 'alipy_plotting.pdf'))
            else:
                plt.savefig(saving_path)
        if show:
            try:
                # show before draw will raise an error in some versions of matplotlib
                plt.show()
            except:
                plt.draw()
                plt.show()
        else:
            return plt
def plot_learning_curves ( self , title = None , x_shift = 0 , start_point = None , plot_interval = None , std_area = False , std_alpha = 0.3 , show = True , saving_path = '.' ) : same , effective_cost , method_cost = self . _check_and_get_total_cost ( ) interplt_interval = plot_interval if plot_interval is not None else effective_cost / 100 # plotting for i in self . _data_extracted . keys ( ) : # get un-aligned row data data_mat = self . _data_extracted [ i ] x_axis = [ [ np . sum ( tup [ 0 ] ) for tup in line ] for line in data_mat ] # calc accumulative cost in x_axis for fold_num in range ( len ( x_axis ) ) : ori_data = x_axis [ fold_num ] acc_data = [ np . sum ( ori_data [ 0 : list_ind + 1 ] ) for list_ind in range ( len ( ori_data ) ) ] x_axis [ fold_num ] = acc_data y_axis = [ [ tup [ 1 ] for tup in line ] for line in data_mat ] if start_point is None : # attempt to infer the start point if not self . _is_all_stateio or self . _data_summary [ i ] . ip is None : pass else : for fold_num in range ( len ( y_axis ) ) : x_axis [ fold_num ] . insert ( 0 , 0 ) y_axis [ fold_num ] . insert ( 0 , self . _data_summary [ i ] . ip ) else : # Use the specified start point for fold_num in range ( len ( y_axis ) ) : x_axis [ fold_num ] . insert ( 0 , 0 ) y_axis [ fold_num ] . insert ( 0 , start_point ) # interpolate intplt_arr = [ ] for fold_num in range ( len ( x_axis ) ) : # len(x_axis) == len(y_axis) intplt_arr . append ( interpolate . interp1d ( x = x_axis [ fold_num ] , y = y_axis [ fold_num ] , bounds_error = False , fill_value = 0.1 ) ) new_x_axis = np . arange ( max ( [ x [ 0 ] for x in x_axis ] ) , effective_cost , interplt_interval ) new_y_axis = [ ] for fold_num in range ( len ( y_axis ) ) : new_y_axis . append ( intplt_arr [ fold_num ] ( new_x_axis ) ) # plot data points = np . mean ( new_y_axis , axis = 0 ) if std_area : std_points = np . std ( new_y_axis , axis = 0 ) plt . plot ( new_x_axis + x_shift , points , label = i ) if std_area : plt . fill_between ( new_x_axis , points - std_points , points + std_points , interpolate = True , alpha = std_alpha ) # axis & title plt . legend ( fancybox = True , framealpha = 0.5 ) plt . xlabel ( "Cost" ) plt . ylabel ( "Performance" ) if title is not None : plt . title ( str ( title ) ) # saving if saving_path is not None : saving_path = os . path . abspath ( saving_path ) if os . path . isdir ( saving_path ) : try : plt . savefig ( os . path . join ( saving_path , 'alipy_plotting.jpg' ) ) except : plt . savefig ( os . path . join ( saving_path , 'alipy_plotting.pdf' ) ) else : plt . savefig ( saving_path ) if show : try : # show before draw will raise an error in some versions of matplotlib plt . show ( ) except : plt . draw ( ) plt . show ( ) else : return plt