Initialize the simulation period with current input_data_frame
503024
def init_entity(self, entity = None, input_data_frame = None, period = None, simulation = None):
        
        assert entity is not None
        assert input_data_frame is not None
        assert period is not None
        assert simulation is not None
        used_as_input_variables = self.used_as_input_variables_by_entity[entity]

        variables_mismatch = set(used_as_input_variables).difference(set(input_data_frame.columns)) if used_as_input_variables else None
        if variables_mismatch:
            log.info(
                'The following variables are used as input variables are not present in the input data frame: \n {}'.format(
                    sorted(variables_mismatch)))
        if variables_mismatch:
            log.debug('The following variables are used as input variables: \n {}'.format(
                sorted(used_as_input_variables)))
            log.debug('The input_data_frame contains the following variables: \n {}'.format(
                sorted(list(input_data_frame.columns))))

        entity = simulation.entities[entity]
        id_variables = [
            self.id_variable_by_entity_key[_entity.key] for _entity in simulation.entities.values()
            if not _entity.is_person]
        role_variables = [
            self.role_variable_by_entity_key[_entity.key] for _entity in simulation.entities.values()
            if not _entity.is_person]

        if entity.is_person:
            for id_variable in id_variables + role_variables:
                assert id_variable in input_data_frame.columns, \
                    "Variable {} is not present in input dataframe".format(id_variable)

        input_data_frame = self.filter_input_variables(input_data_frame = input_data_frame, simulation = simulation)

        if entity.is_person:
            entity.count = entity.step_size = len(input_data_frame)
            for collective_entity in simulation.entities.values():
                if collective_entity.is_person:
                    continue
                _key = collective_entity.key
                _id_variable = self.id_variable_by_entity_key[_key]
                _role_variable = self.role_variable_by_entity_key[_key]

                collective_entity.count = len(input_data_frame[_id_variable].unique())
                collective_entity.members_entity_id = input_data_frame[_id_variable].astype('int').values
                # TODO remove legacy use
                collective_entity.members_legacy_role = input_data_frame[_role_variable].astype('int').values

                for (legacy_role, flattened_role) in enumerate(collective_entity.flattened_roles):
                    if legacy_role < len(collective_entity.flattened_roles):
                        collective_entity.members_role = np.where(
                            collective_entity.members_legacy_role == legacy_role,
                            flattened_role,
                            collective_entity.members_role,
                            )
                    else:
                        collective_entity.members_role = np.where(
                            collective_entity.members_legacy_role >= len(collective_entity.flattened_roles),
                            collective_entity.flattened_roles[-1],
                            collective_entity.members_role,
                            )

        else:
            entity.count = entity.step_size = len(input_data_frame)

        for column_name, column_serie in input_data_frame.iteritems():
            if column_name in (id_variables + role_variables):
                continue

            variable_instance = self.tax_benefit_system.variables.get(column_name)
            if variable_instance.entity.key != entity.key:
                log.info("Ignoring variable {} which is not part of entity {} but {}".format(
                    column_name, entity.key, variable_instance.entity.key))
                continue

            init_variable_in_entity(
                entity = entity,
                variable_name = column_name,
                series = column_serie,
                period = period,
                )
164711
def _post_init(self):
        
        if not hasattr(self, '_buffer'):
            # only set _buffer if model was not specified in the __init__
            self._buffer = TreeBuffer()
        self.read_branches_on_demand = False
        self._branch_cache = {}
        self._current_entry = 0
        self._always_read = []
        self.userdata = UserData()
        self._inited = True
1249012
def _load_init(self, data, ctx):
        """"""
        if self.shape:
            for self_dim, data_dim in zip(self.shape, data.shape):
                assert self_dim in (0, data_dim), \
                    "Failed loading Parameter '%s' from saved params: " \
                    "shape incompatible expected %s vs saved %s"%(
                        self.name, str(self.shape), str(data.shape))
            self.shape = tuple(i if i != 0 else j for i, j in zip(self.shape, data.shape))
        if self.dtype:
            assert np.dtype(self.dtype).type == data.dtype, \
                "Failed loading Parameter '%s' from saved params: " \
                "dtype incompatible expected %s vs saved %s"%(
                    self.name, str(self.dtype), str(data.dtype))
        if self._stype != data.stype:
            data = data.tostype(self._stype)
        if isinstance(ctx, Context):
            ctx = [ctx]
        if self._data is None:
            if self._deferred_init:
                assert ctx is None or set(ctx) == set(self._deferred_init[1]), \
                    "Failed to load Parameter '%s' on %s because it was " \
                    "previous initialized on %s."%(
                        self.name, str(ctx), str(self.list_ctx()))
                ctx = self._deferred_init[1]
            elif ctx is None:
                ctx = [cpu()]
            self._init_impl(data, ctx)
        else:
            assert ctx is None or set(ctx) == set(self.list_ctx()), \
                "Failed to load Parameter '%s' on %s because it was " \
                "previous initialized on %s."%(
                    self.name, str(ctx), str(self.list_ctx()))
            self.set_data(data)
        self._deferred_init = ()
149143
def add_to_initial_stack(self, frame):
    """"""
    if not self._setable_initial_frames:
      raise ValueError(
          "This instance does not allow to manually set initial frame stack.")
    assert_msg = "{}, {}".format(frame.shape, self._initial_frames.shape[:1])
    assert frame.shape == self._initial_frames.shape[2:], assert_msg
    initial_frames = np.roll(self._initial_frames, shift=-1, axis=1)
    initial_frames[0, -1, ...] = frame
    self._initial_frames = initial_frames
385933
def initialize(self):
        
        self.grid()

        self.respond = ttk.Button(self, text='Get Response', command=self.get_response)
        self.respond.grid(column=0, row=0, sticky='nesw', padx=3, pady=3)

        self.usr_input = ttk.Entry(self, state='normal')
        self.usr_input.grid(column=1, row=0, sticky='nesw', padx=3, pady=3)

        self.conversation_lbl = ttk.Label(self, anchor=tk.E, text='Conversation:')
        self.conversation_lbl.grid(column=0, row=1, sticky='nesw', padx=3, pady=3)

        self.conversation = ScrolledText.ScrolledText(self, state='disabled')
        self.conversation.grid(column=0, row=2, columnspan=2, sticky='nesw', padx=3, pady=3)
858138
def init(self):
        '''
        
        '''
        self.previous_value = None
        self.last_update_time = None
        self.start_time = None
        self.updates = 0
        self.end_time = None
        self.extra = dict()
        self._last_update_timer = timeit.default_timer()
622553
def process_frame(self):
        
        input_name = self.inputs[0]
        output_name = self.outputs[0]
        in_frame = self.input_buffer[input_name].get()
        out_frame = self.outframe_pool[output_name].get()
        out_frame.initialise(in_frame)
        if self.transform(in_frame, out_frame):
            self.send(output_name, out_frame)
        else:
            raise StopIteration()
1337807
def _init_params_default(self):
        
        # if there are some nan -> mean impute
        Yimp = self.Y.copy()
        Inan = sp.isnan(Yimp)
        Yimp[Inan] = Yimp[~Inan].mean()
        if self.P==1:   C = sp.array([[Yimp.var()]])
        else:           C = sp.cov(Yimp.T)
        C /= float(self.n_randEffs)
        for ti in range(self.n_randEffs):
            self.getTraitCovarFun(ti).setCovariance(C)
1098276
def init(self):
        """"""
        from itertools import chain

        def maybe_int(v):
            try:
                return int(v)
            except ValueError:
                return None

        if not self.initialized:

            self.data_start_line = 1
            self.data_end_line = None
            self.header_lines = [0]

            if self.source.start_line:
                self.data_start_line = self.source.start_line
            if self.source.end_line:
                self.data_end_line = self.source.end_line
            if self.source.header_lines:
                self.header_lines = list(map(maybe_int, self.source.header_lines))
            if self.source.comment_lines:
                self.header_comment_lines = list(map(maybe_int, self.source.comment_lines))

            max_header_line = max(chain(self.header_comment_lines, self.header_lines))

            if self.data_start_line <= max_header_line:
                self.data_start_line = max_header_line + 1

            if not self.header_comment_lines:
                min_header_line = min(chain(self.header_lines))
                if min_header_line:
                    self.header_comment_lines = list(range(0, min_header_line))

            self.headers = []
            self.header_comments = []
            self.footers = []

            self.initialized = True
            self.i = 0
576618
def _init_state(self, initial_state: Union[int, np.ndarray]):
        """"""
        state = np.reshape(
            sim.to_valid_state_vector(initial_state, self._num_qubits),
            (self._num_shards, self._shard_size))
        state_handle = mem_manager.SharedMemManager.create_array(
            state.view(dtype=np.float32))
        self._shared_mem_dict['state_handle'] = state_handle
873856
@Override protected void init() throws IllegalArgumentException {
    super.init();
    /* Check input parameters */
    float sum = 0;
    long nrows = source.numRows();
    if (nrows <= ratios.length) throw new IllegalArgumentException("Dataset does not have enough row to be split!");
    for (int i=0; i<ratios.length; i++) {
      if (!(ratios[i] > 0 && ratios[i] < 1)) throw new IllegalArgumentException("Split ration has to be in (0,1) interval!");
      if (ratios[i] * nrows <= 1) throw new IllegalArgumentException("Ratio " + ratios[i] + " produces empty frame since the source frame has only " + nrows + "!");
      sum += ratios[i];
    }
    if (!(sum<1f)) throw new IllegalArgumentException("Sum of split ratios has to be less than 1!");
  }
926553
def initialize():
        
        NST.running = True
        pg = Page("http://www.neopets.com/")
        
        curtime = pg.find("td", {'id': 'nst'}).text
        NST.curTime = datetime.datetime.strptime(curtime.replace(" NST", ""), "%I:%M:%S %p") + datetime.timedelta(0,2)
        
        NST.inst = NST()
        NST.daemon = True # Ensures the thread is properly destroyed when the master thread terminates
        NST.inst.start()
346395
def insert_data_frame(col, df, int_col=None, binary_col=None, minimal_size=5):
    
    data = transform.to_dict_list_generic_type(df,
                                               int_col=int_col,
                                               binary_col=binary_col)
    smart_insert(col, data, minimal_size)
747770
def initialize(self):
    
    if self._pooler is None:
      params = {
        "inputWidth": self.inputWidth,
        "lateralInputWidths": [self.cellCount] * self.numOtherCorticalColumns,
        "cellCount": self.cellCount,
        "sdrSize": self.sdrSize,
        "onlineLearning": self.onlineLearning,
        "maxSdrSize": self.maxSdrSize,
        "minSdrSize": self.minSdrSize,
        "synPermProximalInc": self.synPermProximalInc,
        "synPermProximalDec": self.synPermProximalDec,
        "initialProximalPermanence": self.initialProximalPermanence,
        "minThresholdProximal": self.minThresholdProximal,
        "sampleSizeProximal": self.sampleSizeProximal,
        "connectedPermanenceProximal": self.connectedPermanenceProximal,
        "predictedInhibitionThreshold": self.predictedInhibitionThreshold,
        "synPermDistalInc": self.synPermDistalInc,
        "synPermDistalDec": self.synPermDistalDec,
        "initialDistalPermanence": self.initialDistalPermanence,
        "activationThresholdDistal": self.activationThresholdDistal,
        "sampleSizeDistal": self.sampleSizeDistal,
        "connectedPermanenceDistal": self.connectedPermanenceDistal,
        "inertiaFactor": self.inertiaFactor,
        "seed": self.seed,
      }
      self._pooler = ColumnPooler(**params)
562943
def _initialize(self):
        """"""

        self.log.debug("Start initializing data from %s",
                       self.url)
        resp = self.get(self.url,
                        verify=False,
                        proxies=self.rtc_obj.proxies,
                        headers=self.rtc_obj.headers)
        self.__initialize(resp)
        self.log.info("Finish the initialization for <%s %s>",
                      self.__class__.__name__, self)
1005619
def initialize_plot(self, ranges=None):
        
        # Get element key and ranges for frame
        fig = self.generate_plot(self.keys[-1], ranges)
        self.drawn = True
        return fig
1217277
def specify_data_set(self, x_input, y_input):
        
        self.x = x_input
        self.y = y_input