def update(self): TemplateNodeMixin.update(self) meta_outports = self.template_meta_setup().outports meta_inports = self.template_meta_setup().inports required = { 'month': 'int16', 'year': 'int16', 'sample_id': 'int64', } meta_inports[self.COV_IN] = required meta_inports[self.ORDER_IN] = required json = {} input_meta = self.get_input_meta() if self.COV_IN in input_meta: assets = int(math.sqrt(len(input_meta[self.COV_IN]) - 3)) for i in range(assets): json[i] = 'float64' elif self.ORDER_IN in input_meta: assets = len(input_meta[self.ORDER_IN]) - 3 for i in range(assets): json[i] = 'float64' json.update(required) meta_outports[self.OUTPUT_PORT_NAME] = json self.template_meta_setup(in_ports=meta_inports, out_ports=meta_outports)
def update(self): TemplateNodeMixin.update(self) meta_outports = self.template_meta_setup().outports meta_inports = self.template_meta_setup().inports required = { 'year': 'int16', 'month': 'int16', 'sample_id': 'int64', } name = self.conf.get("name", "feature") input_meta = self.get_input_meta() if self.FEATURE_DF not in input_meta: col_from_inport = required.copy() else: col_from_inport = input_meta[self.FEATURE_DF].copy() meta_inports[self.SIGNAL_DF] = required meta_inports[self.FEATURE_DF] = required # additional ports cols = { name+"_mean": "float64", name+"_std": "float64" } col_from_inport.update(cols) meta_outports[self.OUTPUT_PORT_NAME] = col_from_inport self.template_meta_setup( in_ports=meta_inports, out_ports=meta_outports )
def update(self): TemplateNodeMixin.update(self) input_meta = self.get_input_meta() meta_inports = self.template_meta_setup().inports if self.INPUT_PORT_MODEL_NAME in input_meta: if 'train' in input_meta[self.INPUT_PORT_MODEL_NAME]: required_cols = input_meta[self.INPUT_PORT_MODEL_NAME]['train'] else: required_cols = {} meta_inports[self.INPUT_PORT_NAME] = required_cols else: if self.INPUT_PORT_NAME in input_meta: col_from_inport = input_meta[self.INPUT_PORT_NAME] else: col_from_inport = {} enums = [col for col in col_from_inport.keys()] if 'columns' in self.conf: if self.conf.get('include', True): included_colums = self.conf['columns'] else: included_colums = [ col for col in enums if col not in self.conf['columns'] ] for col in included_colums: if col in col_from_inport: meta_inports[ self.INPUT_PORT_NAME][col] = col_from_inport[col] else: meta_inports[self.INPUT_PORT_NAME][col] = None self.template_meta_setup(in_ports=meta_inports, out_ports=None)
def init(self): TemplateNodeMixin.init(self) self.INPUT_PORT_NAME = 'in' self.OUTPUT_PORT_NAME = 'out' port_type = PortsSpecSchema.port_type port_inports = { self.INPUT_PORT_NAME: { port_type: [ "pandas.DataFrame", "cudf.DataFrame", "dask_cudf.DataFrame", "dask.dataframe.DataFrame" ] }, } port_outports = {self.OUTPUT_PORT_NAME: {port_type: "${port:in}"}} cols_required = {"asset": "int64"} if 'column' in self.conf: retention = {self.conf['column']: "float64", "asset": "int64"} else: retention = {"asset": "int64"} meta_inports = {self.INPUT_PORT_NAME: cols_required} meta_outports = { self.OUTPUT_PORT_NAME: { MetaDataSchema.META_OP: MetaDataSchema.META_OP_RETENTION, MetaDataSchema.META_DATA: retention } } self.template_ports_setup(in_ports=port_inports, out_ports=port_outports) self.template_meta_setup(in_ports=meta_inports, out_ports=meta_outports)
def update(self): TemplateNodeMixin.update(self) meta_outports = self.template_meta_setup().outports meta_inports = self.template_meta_setup().inports cols_required = {} input_meta = self.get_input_meta() if (self.INPUT_PORT_LEFT_NAME in input_meta and self.INPUT_PORT_RIGHT_NAME in input_meta): col_from_left_inport = input_meta[self.INPUT_PORT_LEFT_NAME] col_from_right_inport = input_meta[self.INPUT_PORT_RIGHT_NAME] col_from_left_inport.update(col_from_right_inport) meta_outports[self.OUTPUT_PORT_NAME] = col_from_left_inport elif self.INPUT_PORT_LEFT_NAME in input_meta: col_from_left_inport = input_meta[self.INPUT_PORT_LEFT_NAME] meta_outports[self.OUTPUT_PORT_NAME] = col_from_left_inport elif self.INPUT_PORT_RIGHT_NAME in input_meta: col_from_right_inport = input_meta[self.INPUT_PORT_RIGHT_NAME] meta_outports[self.OUTPUT_PORT_NAME] = col_from_right_inport else: meta_outports[self.OUTPUT_PORT_NAME] = {} meta_inports[self.INPUT_PORT_RIGHT_NAME] = cols_required meta_inports[self.INPUT_PORT_LEFT_NAME] = cols_required self.template_meta_setup( in_ports=meta_inports, out_ports=meta_outports )
def init(self): TemplateNodeMixin.init(self) self.delayed_process = True self.infer_meta = False self.SIGNAL_DF = 'signal_df' self.FEATURE_DF = 'feature_df' self.OUTPUT_PORT_NAME = 'out' port_type = PortsSpecSchema.port_type port_inports = { self.SIGNAL_DF: { port_type: [ "pandas.DataFrame", "cudf.DataFrame", "dask_cudf.DataFrame", "dask.dataframe.DataFrame" ] }, self.FEATURE_DF: { port_type: [ "pandas.DataFrame", "cudf.DataFrame", "dask_cudf.DataFrame", "dask.dataframe.DataFrame" ], PortsSpecSchema.optional: True } } port_outports = { self.OUTPUT_PORT_NAME: { port_type: "${port:signal_df}" }, } self.template_ports_setup(in_ports=port_inports, out_ports=port_outports)
def init(self): TemplateNodeMixin.init(self) self.INPUT_PORT_NAME = 'model_in' self.OUTPUT_PORT_NAME = 'filename' port_type = PortsSpecSchema.port_type port_inports = { self.INPUT_PORT_NAME: { port_type: ["xgboost.Booster", "builtins.dict"] } } port_outports = {self.OUTPUT_PORT_NAME: {port_type: ["builtins.str"]}} cols_required = {} addition = {} meta_inports = {self.INPUT_PORT_NAME: cols_required} meta_outports = { self.OUTPUT_PORT_NAME: { MetaDataSchema.META_OP: MetaDataSchema.META_OP_ADDITION, MetaDataSchema.META_REF_INPUT: self.INPUT_PORT_NAME, MetaDataSchema.META_DATA: addition } } self.template_ports_setup(in_ports=port_inports, out_ports=port_outports) self.template_meta_setup(in_ports=meta_inports, out_ports=meta_outports)
def init(self): TemplateNodeMixin.init(self) self.INPUT_PORT_NAME = 'in' self.OUTPUT_PORT_NAME = 'scatter_plot' port_type = PortsSpecSchema.port_type port_inports = { self.INPUT_PORT_NAME: { port_type: [ "pandas.DataFrame", "cudf.DataFrame", "dask_cudf.DataFrame", "dask.dataframe.DataFrame" ] }, } port_outports = {self.OUTPUT_PORT_NAME: {port_type: ["bqplot.Figure"]}} cols_required = {} if 'col_x' in self.conf: cols_required[self.conf['col_x']] = None if 'col_y' in self.conf: cols_required[self.conf['col_y']] = None if 'col_color' in self.conf: cols_required[self.conf['col_color']] = None retension = {} meta_inports = {self.INPUT_PORT_NAME: cols_required} meta_outports = { self.OUTPUT_PORT_NAME: { MetaDataSchema.META_OP: MetaDataSchema.META_OP_RETENTION, MetaDataSchema.META_DATA: retension } } self.template_ports_setup(in_ports=port_inports, out_ports=port_outports) self.template_meta_setup(in_ports=meta_inports, out_ports=meta_outports)
def init(self): TemplateNodeMixin.init(self) self.INPUT_PORT_NAME = 'df_in' self.OUTPUT_PORT_NAME = 'df_out' self.INPUT_NORM_MODEL_NAME = 'norm_data_in' self.OUTPUT_NORM_MODEL_NAME = 'norm_data_out' port_type = PortsSpecSchema.port_type port_inports = { self.INPUT_PORT_NAME: { port_type: [ "pandas.DataFrame", "cudf.DataFrame", "dask_cudf.DataFrame", "dask.dataframe.DataFrame" ] }, self.INPUT_NORM_MODEL_NAME: { port_type: [ "greenflow_gquant_plugin.transform.data_obj.NormalizationData" # noqa ] } } port_outports = { self.OUTPUT_PORT_NAME: { port_type: "${port:df_in}" }, self.OUTPUT_NORM_MODEL_NAME: { port_type: [ "greenflow_gquant_plugin.transform.data_obj.NormalizationData" # noqa ] }, } self.template_ports_setup(in_ports=port_inports, out_ports=port_outports)
def update(self): TemplateNodeMixin.update(self) meta_outports = self.template_meta_setup().outports meta_inports = self.template_meta_setup().inports sub_dict = { 'year': 'int16', 'month': 'int16', 'sample_id': 'int64', } required = { } required.update(sub_dict) meta_inports[self.INPUT_PORT_NAME] = required json_drawdown = {} input_meta = self.get_input_meta() if self.INPUT_PORT_NAME in input_meta: assets = len(input_meta[self.INPUT_PORT_NAME]) - 3 for i in range(assets): json_drawdown[i] = 'float64' json_drawdown.update(sub_dict) meta_outports[self.OUTPUT_PORT_NAME] = json_drawdown self.template_meta_setup( in_ports=meta_inports, out_ports=meta_outports )
def init(self): TemplateNodeMixin.init(self) self.INPUT_PORT_NAME = 'in' self.OUTPUT_PORT_NAME = 'out' self.delayed_process = True self.infer_meta = False port_type = PortsSpecSchema.port_type port_inports = { self.INPUT_PORT_NAME: { port_type: [ "pandas.DataFrame", "cudf.DataFrame", "dask_cudf.DataFrame", "dask.dataframe.DataFrame" ] } } port_outports = {self.OUTPUT_PORT_NAME: {port_type: "${port:in}"}} cols_required = { 'sample_id': 'int64', 'year': 'int16', 'month': 'int16', } meta_inports = {self.INPUT_PORT_NAME: cols_required} meta_outports = { self.OUTPUT_PORT_NAME: { MetaDataSchema.META_OP: MetaDataSchema.META_OP_RETENTION, MetaDataSchema.META_DATA: {} } } self.template_ports_setup(in_ports=port_inports, out_ports=port_outports) self.template_meta_setup(in_ports=meta_inports, out_ports=meta_outports)
def init(self): TemplateNodeMixin.init(self) self.INPUT_PORT_NAME = 'in' self.OUTPUT_PORT_NAME = 'out' port_type = PortsSpecSchema.port_type port_inports = { self.INPUT_PORT_NAME: { port_type: [ "pandas.DataFrame", "cudf.DataFrame", "dask_cudf.DataFrame", "dask.dataframe.DataFrame" ] }, } port_outports = {self.OUTPUT_PORT_NAME: {port_type: "${port:in}"}} cols_required = {"asset": "int64"} addition = {} meta_inports = {self.INPUT_PORT_NAME: cols_required} meta_outports = { self.OUTPUT_PORT_NAME: { MetaDataSchema.META_OP: MetaDataSchema.META_OP_ADDITION, MetaDataSchema.META_REF_INPUT: self.INPUT_PORT_NAME, MetaDataSchema.META_DATA: addition } } self.template_ports_setup(in_ports=port_inports, out_ports=port_outports) self.template_meta_setup(in_ports=meta_inports, out_ports=meta_outports)
def init(self): TemplateNodeMixin.init(self) self.INPUT_PORT_NAME = 'in' self.OUTPUT_PORT_NAME = 'cum_return' port_type = PortsSpecSchema.port_type port_inports = { self.INPUT_PORT_NAME: { port_type: [ "pandas.DataFrame", "cudf.DataFrame", "dask_cudf.DataFrame", "dask.dataframe.DataFrame" ] }, } port_outports = { self.OUTPUT_PORT_NAME: { port_type: ["matplotlib.figure.Figure"] } } cols_required = { "datetime": "datetime64[ns]", "strategy_returns": "float64" } retension = {} meta_inports = {self.INPUT_PORT_NAME: cols_required} meta_outports = { self.OUTPUT_PORT_NAME: { MetaDataSchema.META_OP: MetaDataSchema.META_OP_RETENTION, MetaDataSchema.META_DATA: retension } } self.template_ports_setup(in_ports=port_inports, out_ports=port_outports) self.template_meta_setup(in_ports=meta_inports, out_ports=meta_outports)
def init(self): TemplateNodeMixin.init(self) self.COV_IN = 'covariance_df' self.ORDER_IN = 'asset_order_df' self.OUTPUT_PORT_NAME = 'out' self.delayed_process = True self.infer_meta = False port_type = PortsSpecSchema.port_type port_inports = { self.COV_IN: { port_type: [ "pandas.DataFrame", "cudf.DataFrame", "dask_cudf.DataFrame", "dask.dataframe.DataFrame" ] }, self.ORDER_IN: { port_type: [ "pandas.DataFrame", "cudf.DataFrame", "dask_cudf.DataFrame", "dask.dataframe.DataFrame" ] } } port_outports = { self.OUTPUT_PORT_NAME: { port_type: "${port:covariance_df}" }, } self.template_ports_setup(in_ports=port_inports, out_ports=port_outports)
def init(self): TemplateNodeMixin.init(self) inports = { 'signal': { PortsSpecSchema.port_type: [cp.ndarray, np.ndarray] }, 'samplerate': { PortsSpecSchema.port_type: [int, float, np.float32, np.float64], PortsSpecSchema.optional: True }, 'window': { PortsSpecSchema.port_type: [cp.ndarray, np.ndarray], PortsSpecSchema.optional: True }, } outports = { 'signal_out': { PortsSpecSchema.port_type: '${port:signal}' }, 'samplerate_out': { PortsSpecSchema.port_type: [int, float, np.float32, np.float64], PortsSpecSchema.optional: True } } self.template_ports_setup(in_ports=inports, out_ports=outports) meta_outports = {'signal_out': {}, 'samplerate_out': {}} self.template_meta_setup(out_ports=meta_outports)
def init(self): TemplateNodeMixin.init(self) self.INPUT_PORT_NAME = 'in' self.OUTPUT_PORT_NAME = 'importance_curve' port_type = PortsSpecSchema.port_type port_inports = { self.INPUT_PORT_NAME: { port_type: ["xgboost.Booster", "builtins.dict"] } } port_outports = { self.OUTPUT_PORT_NAME: { port_type: ["matplotlib.figure.Figure"] } } cols_required = {} retension = {} meta_inports = {self.INPUT_PORT_NAME: cols_required} meta_outports = { self.OUTPUT_PORT_NAME: { MetaDataSchema.META_OP: MetaDataSchema.META_OP_RETENTION, MetaDataSchema.META_DATA: retension } } self.template_ports_setup(in_ports=port_inports, out_ports=port_outports) self.template_meta_setup(in_ports=meta_inports, out_ports=meta_outports)
def init(self): TemplateNodeMixin.init(self) self.INPUT_PORT_NAME = 'in' self.OUTPUT_PORT_NAME = 'out' port_type = PortsSpecSchema.port_type port_inports = { self.INPUT_PORT_NAME: { port_type: ["pandas.DataFrame", "cudf.DataFrame"] }, } port_outports = { self.OUTPUT_PORT_NAME: { port_type: "builtins.float" }, } meta_inports = {self.INPUT_PORT_NAME: {}} meta_outports = { self.OUTPUT_PORT_NAME: { MetaDataSchema.META_OP: MetaDataSchema.META_OP_ADDITION, MetaDataSchema.META_REF_INPUT: self.INPUT_PORT_NAME, MetaDataSchema.META_DATA: {} } } self.template_ports_setup(in_ports=port_inports, out_ports=port_outports) self.template_meta_setup(in_ports=meta_inports, out_ports=meta_outports)
def update(self): TemplateNodeMixin.update(self) input_meta = self.get_input_meta() meta_outports = self.template_meta_setup().outports meta_inports = self.template_meta_setup().inports required = meta_inports[self.INPUT_PORT_NAME] if self.INPUT_PORT_NAME not in input_meta: col_from_inport = {'sample_id': 'int64'} col_ref = {} else: col_from_inport = {'sample_id': 'int64'} col_ref = input_meta[self.INPUT_PORT_NAME].copy() for key in col_ref.keys(): if key in required: continue new_key = key + "_mean" col_from_inport[new_key] = col_ref[key] for key in col_ref.keys(): if key in required: continue new_key = key + "_std" col_from_inport[new_key] = col_ref[key] meta_outports[self.OUTPUT_PORT_NAME] = col_from_inport self.template_meta_setup(in_ports=None, out_ports=meta_outports)
def init(self): TemplateNodeMixin.init(self) self.INPUT_PORT_NAME = 'in' self.OUTPUT_PORT_NAME = 'out' self.delayed_process = True port_type = PortsSpecSchema.port_type port_inports = { self.INPUT_PORT_NAME: { port_type: [ "pandas.DataFrame", "cudf.DataFrame", "dask_cudf.DataFrame", "dask.dataframe.DataFrame" ] }, } port_outports = {self.OUTPUT_PORT_NAME: {port_type: "${port:in}"}} cols_required = {} addition = {} for col in self.conf: for cat in col['cats']: name = col.get('prefix') + col.get('prefix_sep', '_') + str(cat) addition.update({name: col.get('dtype', 'float64')}) meta_inports = {self.INPUT_PORT_NAME: cols_required} meta_outports = { self.OUTPUT_PORT_NAME: { MetaDataSchema.META_OP: MetaDataSchema.META_OP_ADDITION, MetaDataSchema.META_REF_INPUT: self.INPUT_PORT_NAME, MetaDataSchema.META_DATA: addition } } self.template_ports_setup(in_ports=port_inports, out_ports=port_outports) self.template_meta_setup(in_ports=meta_inports, out_ports=meta_outports)
def init(self): TemplateNodeMixin.init(self) self.INPUT_PORT_LEFT_NAME = 'left' self.INPUT_PORT_RIGHT_NAME = 'right' self.OUTPUT_PORT_NAME = 'merged' self.delayed_process = True self.infer_meta = False port_type = PortsSpecSchema.port_type port_inports = { self.INPUT_PORT_LEFT_NAME: { port_type: [ "pandas.DataFrame", "cudf.DataFrame", "dask_cudf.DataFrame", "dask.dataframe.DataFrame" ] }, self.INPUT_PORT_RIGHT_NAME: { port_type: [ "pandas.DataFrame", "cudf.DataFrame", "dask_cudf.DataFrame", "dask.dataframe.DataFrame" ] } } port_outports = { self.OUTPUT_PORT_NAME: { port_type: "${port:left}" }, } self.template_ports_setup(in_ports=port_inports, out_ports=port_outports)
def init(self): TemplateNodeMixin.init(self) self.delayed_process = True self.INPUT_PORT_NAME = 'stock_in' self.OUTPUT_PORT_NAME = 'stock_out' port_type = PortsSpecSchema.port_type port_inports = { self.INPUT_PORT_NAME: { port_type: [ "pandas.DataFrame", "cudf.DataFrame", "dask_cudf.DataFrame", "dask.dataframe.DataFrame" ] }, } port_outports = { self.OUTPUT_PORT_NAME: { port_type: "${port:stock_in}" } } cols_required = {'indicator': 'int32'} addition = {} if 'indicators' in self.conf: indicators = self.conf['indicators'] for indicator in indicators: functionId = indicator['function'] conf = copy.deepcopy(IN_DATA[functionId]) if 'args' in indicator: if len(conf['args']) != 0: conf['args'] = indicator['args'] if 'columns' in indicator: conf['columns'] = indicator['columns'] for col in conf['columns']: cols_required[col] = 'float64' if 'outputs' in conf: for out in conf['outputs']: out_col = self._compose_name(conf, [out]) addition[out_col] = 'float64' else: out_col = self._compose_name(conf, []) addition[out_col] = 'float64' meta_inports = { self.INPUT_PORT_NAME: cols_required } meta_outports = { self.OUTPUT_PORT_NAME: { MetaDataSchema.META_OP: MetaDataSchema.META_OP_ADDITION, MetaDataSchema.META_REF_INPUT: self.INPUT_PORT_NAME, MetaDataSchema.META_DATA: addition } } self.template_ports_setup( in_ports=port_inports, out_ports=port_outports ) self.template_meta_setup( in_ports=meta_inports, out_ports=meta_outports )
def init(self): TemplateNodeMixin.init(self) port_type = PortsSpecSchema.port_type outports = {'window': {port_type: [cp.ndarray, np.ndarray]}} self.template_ports_setup(out_ports=outports) meta_outports = {'window': {}} self.template_meta_setup(out_ports=meta_outports)
def init(self): TemplateNodeMixin.init(self) port_type = PortsSpecSchema.port_type inports = {'signal': {port_type: [cp.ndarray, np.ndarray]}} outports = {'signal_out': {port_type: '${port:signal}'}} self.template_ports_setup(in_ports=inports, out_ports=outports) meta_outports = {'signal_out': {}} self.template_meta_setup(out_ports=meta_outports)
def update(self): TemplateNodeMixin.update(self) name = self._find_asset_name() asset_retension = {"asset_name": name} meta_outports = self.template_meta_setup().outports meta_outports[self.OUTPUT_ASSET_NAME][ MetaDataSchema.META_DATA] = asset_retension self.template_meta_setup( in_ports=None, out_ports=meta_outports )
def init(self): TemplateNodeMixin.init(self) self.INPUT_PORT_NAME = 'stock_in' self.OUTPUT_PORT_NAME = 'stock_out' self.INPUT_MAP_NAME = 'name_map' self.OUTPUT_ASSET_NAME = 'stock_name' port_type = PortsSpecSchema.port_type port_inports = { self.INPUT_PORT_NAME: { port_type: [ "pandas.DataFrame", "cudf.DataFrame", "dask_cudf.DataFrame", "dask.dataframe.DataFrame" ] }, self.INPUT_MAP_NAME: { port_type: [ "greenflow_gquant_plugin.dataloader.stockMap.StockMap" ] } } port_outports = { self.OUTPUT_PORT_NAME: { port_type: "${port:stock_in}" }, self.OUTPUT_ASSET_NAME: { port_type: ['builtins.str'] } } cols_required = {"asset": "int64"} meta_inports = { self.INPUT_PORT_NAME: cols_required, self.INPUT_MAP_NAME: {} } meta_outports = { self.OUTPUT_PORT_NAME: { MetaDataSchema.META_OP: MetaDataSchema.META_OP_ADDITION, MetaDataSchema.META_REF_INPUT: self.INPUT_PORT_NAME, MetaDataSchema.META_DATA: {} }, self.OUTPUT_ASSET_NAME: { MetaDataSchema.META_OP: MetaDataSchema.META_OP_RETENTION, MetaDataSchema.META_DATA: {} } } self.template_ports_setup( in_ports=port_inports, out_ports=port_outports ) self.template_meta_setup( in_ports=meta_inports, out_ports=meta_outports )
def update(self): TemplateNodeMixin.update(self) input_meta = self.get_input_meta() predict = self.conf.get('prediction', 'predict') pred_contribs: bool = self.conf.get('pred_contribs', False) meta_inports = self.template_meta_setup().inports meta_outports = self.template_meta_setup().outports if (self.INPUT_PORT_NAME in input_meta and self.INPUT_PORT_MODEL_NAME in input_meta): col_from_inport = input_meta[self.INPUT_PORT_NAME] if 'train' in input_meta[self.INPUT_PORT_MODEL_NAME]: required_cols = input_meta[ self.INPUT_PORT_MODEL_NAME]['train'] else: required_cols = {} if not pred_contribs: col_from_inport[predict] = None # the type is not determined else: col_from_inport = {} for i in range(len(required_cols)+1): col_from_inport[i] = None meta_inports[self.INPUT_PORT_NAME] = required_cols meta_outports[self.OUTPUT_PORT_NAME][ MetaDataSchema.META_DATA] = col_from_inport elif (self.INPUT_PORT_NAME not in input_meta and self.INPUT_PORT_MODEL_NAME in input_meta): if 'train' in input_meta[self.INPUT_PORT_MODEL_NAME]: required_cols = input_meta[ self.INPUT_PORT_MODEL_NAME]['train'] else: required_cols = {} col_from_inport = copy.copy(required_cols) if not pred_contribs: col_from_inport[predict] = None # the type is not determined else: col_from_inport = {} for i in range(len(required_cols)+1): col_from_inport[i] = None meta_inports[self.INPUT_PORT_NAME] = required_cols meta_outports[self.OUTPUT_PORT_NAME][ MetaDataSchema.META_DATA] = col_from_inport elif (self.INPUT_PORT_NAME in input_meta and self.INPUT_PORT_MODEL_NAME not in input_meta): col_from_inport = input_meta[self.INPUT_PORT_NAME] if not pred_contribs: col_from_inport[predict] = None # the type is not determined meta_outports[self.OUTPUT_PORT_NAME][ MetaDataSchema.META_DATA] = col_from_inport self.template_meta_setup( in_ports=meta_inports, out_ports=meta_outports )
def init(self): TemplateNodeMixin.init(self) self.delayed_process = True self.infer_meta = False self.OUTPUT_PORT_NAME = 'out' self.DIFF_A = 'diff_a' self.DIFF_B = 'diff_b' port_type = PortsSpecSchema.port_type port_inports = { self.DIFF_A: { port_type: [ "pandas.DataFrame", "cudf.DataFrame", "dask_cudf.DataFrame", "dask.dataframe.DataFrame" ] }, self.DIFF_B: { port_type: [ "pandas.DataFrame", "cudf.DataFrame", "dask_cudf.DataFrame", "dask.dataframe.DataFrame" ] } } port_outports = { self.OUTPUT_PORT_NAME: { port_type: "${port:diff_a}" }, } col_required = { 'sample_id': 'int64', 'portfolio': 'float64', } meta_inports = { self.DIFF_A: col_required, self.DIFF_B: col_required } output_meta = { 'sample_id': 'int64', 'portfolio': 'float64', } meta_outports = { self.OUTPUT_PORT_NAME: { MetaDataSchema.META_OP: MetaDataSchema.META_OP_RETENTION, MetaDataSchema.META_DATA: output_meta } } self.template_ports_setup(in_ports=port_inports, out_ports=port_outports) self.template_meta_setup( in_ports=meta_inports, out_ports=meta_outports )
def init(self): TemplateNodeMixin.init(self) self.delayed_process = True port_type = PortsSpecSchema.port_type self.INPUT_PORT_NAME = "points_df_in" self.OUTPUT_PORT_NAME = "distance_df" self.ABS_OUTPUT_PORT_NAME = "distance_abs_df" port_inports = { self.INPUT_PORT_NAME: { port_type: ["pandas.DataFrame"] } } port_outports = { self.OUTPUT_PORT_NAME: { port_type: "${port:points_df_in}" }, self.ABS_OUTPUT_PORT_NAME: { port_type: "${port:points_df_in}" }, } req_cols = { 'x': 'float64', 'y': 'float64' } meta_inports = { self.INPUT_PORT_NAME: req_cols } meta_outports = { self.OUTPUT_PORT_NAME: { MetaDataSchema.META_OP: MetaDataSchema.META_OP_ADDITION, MetaDataSchema.META_REF_INPUT: self.INPUT_PORT_NAME, MetaDataSchema.META_DATA: { 'distance_cudf': 'float64', } }, self.ABS_OUTPUT_PORT_NAME: { MetaDataSchema.META_OP: MetaDataSchema.META_OP_ADDITION, MetaDataSchema.META_REF_INPUT: self.INPUT_PORT_NAME, MetaDataSchema.META_DATA: { 'distance_abs_cudf': 'float64', } } } self.template_ports_setup( in_ports=port_inports, out_ports=port_outports ) self.template_meta_setup( in_ports=meta_inports, out_ports=meta_outports )
def init(self): TemplateNodeMixin.init(self) port_type = PortsSpecSchema.port_type inports = { 'in1': {port_type: [cp.ndarray, np.ndarray]}, 'in2': {port_type: [cp.ndarray, np.ndarray]} } outports = { 'fftconvolve': {port_type: [cp.ndarray, np.ndarray]}, } self.template_ports_setup(in_ports=inports, out_ports=outports) meta_outports = {'fftconvolve': {}} self.template_meta_setup(out_ports=meta_outports)
def init(self): TemplateNodeMixin.init(self) outports = { 'signal': { PortsSpecSchema.port_type: [cp.ndarray, np.ndarray] }, 'framerate': { PortsSpecSchema.port_type: float }, } self.template_ports_setup(out_ports=outports) meta_outports = {'signal': {}, 'framerate': {}} self.template_meta_setup(out_ports=meta_outports)