Check that fit can be called on reference data
5685
def check(self, feature):
        """"""
        mapper = feature.as_dataframe_mapper()
        mapper.fit(self.X, y=self.y)
1055341
def _analytical_fit_adjacent(self, ref_dists):
        
        dists = ref_dists**2
        rot_dists = self._rotate_rows(dists)
        b = dists - rot_dists + self._partial_b
        self._b = b
        return self._pinvA.dot(b)
1184175
def do_rmfit(self, arg):
        """"""
        if arg in self.curargs["fits"]:
            del self.curargs["fits"][arg]        
        #We also need to remove the variable entry if it exists.
        if "timing" in arg:
            fitvar = "{}|fit".format(arg)
        else:
            fitvar = "{}.fit".format(arg)
        if fitvar in self.curargs["dependents"]:
            self.curargs["dependents"].remove(fitvar)
188414
def _check_names_match(data_names, data_shapes, name, throw):
    """"""
    actual = [x[0] for x in data_shapes]
    if sorted(data_names) != sorted(actual):
        msg = "Data provided by %s_shapes don't match names specified by %s_names (%s vs. %s)"%(
            name, name, str(data_shapes), str(data_names))
        if throw:
            raise ValueError(msg)
        else:
            warnings.warn(msg)
710489
def fit_predict(self,
                    X,
                    num_epochs=10,
                    updates_epoch=10,
                    stop_param_updates=dict(),
                    batch_size=1,
                    show_progressbar=False):
        """"""
        self.fit(X,
                 num_epochs,
                 updates_epoch,
                 stop_param_updates,
                 batch_size,
                 show_progressbar)

        return self.predict(X, batch_size=batch_size)
1235618
def fit_for_distance(self):
        
        for prop in self.properties.keys():
            if prop in self.ic.bands:
                return True
        return False
893558
def start_fitting(self):
        
        self.queue = queue.Queue()
        self.peak_vals = []
        self.fit_thread = QThread() #must be assigned as an instance variable, not local, as otherwise thread is garbage
                                    #collected immediately at the end of the function before it runs
        self.fitobj = self.do_fit(str(self.data_filepath.text()), self.matplotlibwidget, self.queue, self.peak_vals, self.peak_locs)
        self.fitobj.moveToThread(self.fit_thread)
        self.fit_thread.started.connect(self.fitobj.run)
        self.fitobj.finished.connect(self.fit_thread.quit)  # clean up. quit thread after script is finished
        self.fitobj.status.connect(self.update_status)
        self.fit_thread.start()
902855
def find_best_rsquared(list_of_fits):
        """"""
        res = sorted(list_of_fits, key=lambda x: x.rsquared)
        return res[-1]
324341
private void fitParameters(Map<Long, Double> metricData) {
        mean = getMetricMean(metricData);
        variance = getMetricVariance(metricData);
    }
526982
def fit(self, X):
        
        if isinstance(X, (pd.Series, pd.DataFrame)):
            self.name = X.name

        self.constant_value = self._get_constant_value(X)

        if self.constant_value is None:
            self.mean = np.mean(X)
            self.std = np.std(X)

        else:
            self._replace_constant_methods()

        self.fitted = True
920503
def _fit(self, index, width, height):
        """"""
        node = self._atlas_nodes[index]
        x, y = node[0], node[1]
        width_left = width
        if x+width > self._shape[1]:
            return -1
        i = index
        while width_left > 0:
            node = self._atlas_nodes[i]
            y = max(y, node[1])
            if y+height > self._shape[0]:
                return -1
            width_left -= node[2]
            i += 1
        return y
743606
def fit_transform(self, input, **fit_kwargs):
        """"""
        self.fit(input, **fit_kwargs)
        X = self.transform(input)
        return X
399091
def add_highlighted_fits(self, evnet):
        

        specimens = []
        next_i = self.logger.GetNextSelected(-1)
        if next_i == -1: return
        while next_i != -1:
            fit,specimen = self.fit_list[next_i]
            if specimen in specimens:
                next_i = self.logger.GetNextSelected(next_i)
                continue
            else: specimens.append(specimen)
            next_i = self.logger.GetNextSelected(next_i)

        for specimen in specimens:
            self.add_fit_to_specimen(specimen)

        self.update_editor()
        self.parent.update_selection()
483223
def _validate_list_data(self, expected, actual):
        """"""
        for e in expected:
            if e not in actual:
                return "expected item {} not found in actual list".format(e)
        return None
834111
def _check_contigs_to_use(self, ref_dict):
        ''''''
        if self.contigs_to_use is None:
            return True

        for contig in self.contigs_to_use:
            if contig not in ref_dict:
                raise Error('Requested to use contig "' + contig + '", but not found in input BAM file "' + self.bam + '"')

        return True
744517
def fit(self, X, y):
        """"""

        self._data = X
        self._classes = np.unique(y)
        self._labels = y
        self._is_fitted = True
641785
def map_fit(interface, state, label, inp):
    
    import numpy as np
    ete, etde = 0, 0
    out = interface.output(0)

    for row in inp:
        row = row.strip().split(state["delimiter"])  # split row
        if len(row) > 1:  # check if row is empty
            # intercept term is added to every sample
            x = np.array([(0 if v in state["missing_vals"] else float(v)) for i, v in enumerate(row) if
                          i in state["X_indices"]] + [-1])
            # map label value to 1 or -1. If label does not match set error
            y = 1 if state["y_map"][0] == row[state["y_index"]] else -1 if state["y_map"][1] == row[
                state["y_index"]] else "Error"
            ete += np.outer(x, x)
            etde += x * y
    out.add("etde", etde)
    for i, row in enumerate(ete):
        out.add(i, row)