Generate features.
492126
public void generateFeatures() {
	if (features != null) {
	    features.clear();
	} else {
	    features = new ArrayList();
	}		
	
	if (fmap != null) {
	    fmap.clear(); 
	} else {
	    fmap = new HashMap();
	}	
	
	if (currentFeatures != null) {
	    currentFeatures.clear();
	} else {
	    currentFeatures = new ArrayList();
	}
	
	if (data.trnData == null || dict.dict == null) {
	    System.out.println("No data or dictionary for generating features");
	    return;
	}
	
	// scan over data list
	for (int i = 0; i < data.trnData.size(); i++) {
	    Observation obsr = (Observation)data.trnData.get(i);
	    
	    for (int j = 0; j < obsr.cps.length; j++) {
		Element elem = null;
		CountFIdx cntFIdx = null;
		
		elem = (Element)dict.dict.get(new Integer(obsr.cps[j]));
		if (elem != null) {
		    if (elem.count <= option.cpRareThreshold) {
			// skip this context predicate, it is too rare
			continue;
		    }
		    
		    cntFIdx = (CountFIdx)elem.lbCntFidxes.get(new Integer(obsr.humanLabel));
		    if (cntFIdx != null) {
			if (cntFIdx.count <= option.fRareThreshold) {
			    // skip this feature, it is too rare
			    continue;
			}			
			
		    } else {
			// not found in the dictionary, then skip
			continue;
		    }		    
		    
		} else {
		    // not found in the dictionary, then skip
		    continue;
		}
		
		// update the feature		
		Feature f = new Feature(obsr.humanLabel, obsr.cps[j]);
		f.strId2Idx(fmap);
		if (f.idx < 0) {
		    // new feature, add to the feature list
		    addFeature(f);
		    
		    // update the feature index in the dictionary
		    cntFIdx.fidx = f.idx;
		    elem.chosen = 1;
		}
	    }
	}
	
	option.numFeatures = features.size();
    }
265885
def main():
    """"""
    parser = argparse.ArgumentParser(description='A feature engineering wrapper'
                                     ' for machine learning algorithms.',
                                     add_help=False)

    parser.add_argument('INPUT_FILE', type=str,
                        help='Data file to run FEW on; ensure that the '
                        'target/label column is labeled as "label" or "class".')

    parser.add_argument('-h', '--help', action='help',
                        help='Show this help message and exit.')

    parser.add_argument('-is', action='store',dest='INPUT_SEPARATOR',
                        default=None,type=str,
                        help='Character separating columns in the input file.')

    parser.add_argument('-o', action='store', dest='OUTPUT_FILE', default='',
                        type=str, help='File to export the final model.')

    parser.add_argument('-g', action='store', dest='GENERATIONS', default=100,
                        type=positive_integer,
                        help='Number of generations to run FEW.')

    parser.add_argument('-p', action='store', dest='POPULATION_SIZE',default=50,
                         help='Number of individuals in the GP population. '
                         'Follow the number with x to set population size as a'
                         'multiple of raw feature size.')

    parser.add_argument('-mr', action='store', dest='MUTATION_RATE',default=0.5,
                        type=float_range,
                        help='GP mutation rate in the range [0.0, 1.0].')

    parser.add_argument('-xr', action='store', dest='CROSSOVER_RATE',
                        default=0.5,type=float_range,
                        help='GP crossover rate in the range [0.0, 1.0].')

    parser.add_argument('-ml', action='store', dest='MACHINE_LEARNER',
                        default=None,
                        choices = ['lasso','svr','lsvr','lr','svc','rfc','rfr',
                                   'dtc','dtr','dc','knc','knr','sgd'],
                        type=str, help='ML algorithm to pair with features. '
                        'Default: Lasso (regression), LogisticRegression '
                        '(classification)')

    parser.add_argument('-min_depth', action='store', dest='MIN_DEPTH',
                        default=1,type=positive_integer,
                        help='Minimum length of GP programs.')

    parser.add_argument('-max_depth', action='store', dest='MAX_DEPTH',
                        default=2,type=positive_integer,
                        help='Maximum number of nodes in GP programs.')

    parser.add_argument('-max_depth_init', action='store',dest='MAX_DEPTH_INIT',
                        default=2,type=positive_integer,
                        help='Maximum nodes in initial programs.')

    parser.add_argument('-op_weight', action='store',dest='OP_WEIGHT',default=1,
                        type=bool, help='Weight attributes for incuded in'
                        ' features based on ML scores. Default: off')

    parser.add_argument('-ms', action='store', dest='MAX_STALL',default=100,
                        type=positive_integer, help='If model CV does not '
                        'improve for this many generations, end optimization.')

    parser.add_argument('--weight_parents', action='store_true',
                        dest='WEIGHT_PARENTS',default=True,
                        help='Feature importance weights parent selection.')

    parser.add_argument('--lex_size', action='store_true',dest='LEX_SIZE',default=False,
                        help='Size mediated parent selection for lexicase survival.')

    parser.add_argument('-sel', action='store', dest='SEL',
                        default='epsilon_lexicase',
                        choices = ['tournament','lexicase','epsilon_lexicase',
                                   'deterministic_crowding','random'],
                        type=str, help='Selection method (Default: tournament)')

    parser.add_argument('-tourn_size', action='store', dest='TOURN_SIZE',
                        default=2, type=positive_integer,
                        help='Tournament size (Default: 2)')

    parser.add_argument('-fit', action='store', dest='FIT_CHOICE', default=None,
                        choices = ['mse','mae','r2','vaf','mse_rel','mae_rel',
                                   'r2_rel','vaf_rel','silhouette','inertia',
                                   'separation','fisher','random','relief'],
                        type=str,
                        help='Fitness metric (Default: dependent on ml used)')

    parser.add_argument('--no_seed', action='store_false', dest='SEED_WITH_ML',
                        default=True,
                        help='Turn off initial GP population seeding.')

    parser.add_argument('--elitism', action='store_true', dest='ELITISM',
                        default=False,
                        help='Force survival of best feature in GP population.')

    parser.add_argument('--erc', action='store_true', dest='ERC', default=False,
                    help='Use random constants in GP feature construction.')

    parser.add_argument('--bool', action='store_true', dest='BOOLEAN',
                        default=False,
                        help='Include boolean operators in features.')

    parser.add_argument('-otype', action='store', dest='OTYPE', default='f',
                        choices=['f','b'],
                        type=str,
                        help='Feature output type. f: float, b: boolean.')

    parser.add_argument('-ops', action='store', dest='OPS', default=None,
                        type=str,
                        help='Specify operators separated by commas')
    
    parser.add_argument('-dtypes', action='store', dest='DTYPES', default=None,
                        type=str,
                        help='Specify datafile types separated by a comma')
    
    parser.add_argument('--class', action='store_true', dest='CLASSIFICATION',
                        default=False,
                        help='Conduct classification rather than regression.')

    parser.add_argument('--mdr', action='store_true',dest='MDR',default=False,
                        help='Use MDR nodes.')

    parser.add_argument('--nonorm', action='store_false',dest='NORMALIZE',default=True,
                        help='Disable standard scaler preprocessor.')

    parser.add_argument('--diversity', action='store_true',
                        dest='TRACK_DIVERSITY', default=False,
                        help='Store diversity of feature transforms each gen.')

    parser.add_argument('--clean', action='store_true', dest='CLEAN',
                        default=False,
                        help='Clean input data of missing values.')

    parser.add_argument('--no_lib', action='store_false', dest='c',
                        default=True,
                        help='Don''t use optimized c libraries.')

    parser.add_argument('-s', action='store', dest='RANDOM_STATE',
                        default=None,
                        type=int,
                        help='Random number generator seed for reproducibility.'
                        'Note that using multi-threading may make exact results'
                        ' impossible to reproduce.')

    parser.add_argument('-v', action='store', dest='VERBOSITY', default=1,
                        choices=[0, 1, 2, 3], type=int,
                        help='How much information FEW communicates while it is'
                        ' running: 0 = none, 1 = minimal, 2 = lots, 3 = all.')

    parser.add_argument('--no-update-check', action='store_true',
                        dest='DISABLE_UPDATE_CHECK', default=False,
                        help='Don''t check the FEW version.')

    parser.add_argument('--version', action='version',
                        version='FEW {version}'.format(version=__version__),
                        help='Show FEW\'s version number and exit.')

    args = parser.parse_args()

    # if args.VERBOSITY >= 2:
    #     print('\nFEW settings:')
    #     for arg in sorted(args.__dict__):
    #         if arg == 'DISABLE_UPDATE_CHECK':
    #             continue
    #         print('{}\t=\t{}'.format(arg, args.__dict__[arg]))
    #     print('')

    # load data from csv file
    if args.INPUT_SEPARATOR is None:
        input_data = pd.read_csv(args.INPUT_FILE, sep=args.INPUT_SEPARATOR,
                                 engine='python')
    else: # use c engine for read_csv is separator is specified
        input_data = pd.read_csv(args.INPUT_FILE, sep=args.INPUT_SEPARATOR)

    # if 'Label' in input_data.columns.values:
    input_data.rename(columns={'Label': 'label','Class':'label','class':'label',
                               'target':'label'}, inplace=True)

    RANDOM_STATE = args.RANDOM_STATE

    train_i, test_i = train_test_split(input_data.index,
                                       stratify = None,
                                       #stratify=input_data['label'].values,
                                       train_size=0.75,
                                       test_size=0.25,
                                       random_state=RANDOM_STATE)

    training_features = input_data.loc[train_i].drop('label', axis=1).values
    training_labels = input_data.loc[train_i, 'label'].values
    
    testing_features = input_data.loc[test_i].drop('label', axis=1).values
    testing_labels = input_data.loc[test_i, 'label'].values

    learner = FEW(generations=args.GENERATIONS,
                  population_size=args.POPULATION_SIZE,
                  mutation_rate=args.MUTATION_RATE,
                  crossover_rate=args.CROSSOVER_RATE,
                  ml = ml_dict[args.MACHINE_LEARNER],
                  min_depth = args.MIN_DEPTH,max_depth = args.MAX_DEPTH,
                  sel = args.SEL, tourn_size = args.TOURN_SIZE,
                  seed_with_ml = args.SEED_WITH_ML, op_weight = args.OP_WEIGHT,
                  max_stall = args.MAX_STALL,
                  erc = args.ERC, random_state=args.RANDOM_STATE,
                  verbosity=args.VERBOSITY,
                  disable_update_check=args.DISABLE_UPDATE_CHECK,
                  fit_choice = args.FIT_CHOICE,boolean=args.BOOLEAN,
                  classification=args.CLASSIFICATION,clean = args.CLEAN,
                  track_diversity=args.TRACK_DIVERSITY,mdr=args.MDR,
                  otype=args.OTYPE,c=args.c, lex_size = args.LEX_SIZE,
                  weight_parents = args.WEIGHT_PARENTS,operators=args.OPS,
                  normalize=args.NORMALIZE, dtypes = args.DTYPES)

    learner.fit(training_features, training_labels)
    # pdb.set_trace()
    if args.VERBOSITY >= 1:
        print('\nTraining accuracy: {:1.3f}'.format(
            learner.score(training_features, training_labels)))
        print('Test accuracy: {:1.3f}'.format(
            learner.score(testing_features, testing_labels)))

    if args.OUTPUT_FILE != '':
        learner.export(args.OUTPUT_FILE)
545517
def generate(env):
    """"""
    M4Action = SCons.Action.Action('$M4COM', '$M4COMSTR')
    bld = SCons.Builder.Builder(action = M4Action, src_suffix = '.m4')

    env['BUILDERS']['M4'] = bld

    # .m4 files might include other files, and it would be pretty hard
    # to write a scanner for it, so let's just cd to the dir of the m4
    # file and run from there.
    # The src_suffix setup is like so: file.c.m4 -> file.c,
    # file.cpp.m4 -> file.cpp etc.
    env['M4']      = 'm4'
    env['M4FLAGS'] = SCons.Util.CLVar('-E')
    env['M4COM']   = 'cd ${SOURCE.rsrcdir} && $M4 $M4FLAGS < ${SOURCE.file} > ${TARGET.abspath}'
1061656
def update_features(self, poly):
        """"""

        for feature in self.features:
            feature.wavelength = poly(feature.xpos)
849311
def features(self):
        """"""

        r = []
        for _, inter in self.props.items():
            if isinstance(inter, tuple):
                if (inter[0] and inter[1] and inter[0].getValue() == inter[1].getValue() and
                        inter[0].operator == "=" and inter[1].operator == "="):
                    r.append(inter[0])
                else:
                    r.extend([f for f in inter if f])
            elif isinstance(inter, dict):
                r.extend(inter.values())
            elif isinstance(inter, list):
                r.extend(inter)
            else:
                r.append(inter)
        return r
46481
def _generate(self):
        """

        self._data['key'] = self.key
        self._data['value'] = self.value
        self._data['host'] = self.host
        self._data['clock'] = self.clock
25996
def learn_generated(self, feature_generator):
        '''
        

        '''
        if isinstance(feature_generator, FeatureGenerator) is False:
            raise TypeError("The type of `feature_generator` must be `FeatureGenerator`.")

        # Pre-learning.
        if self.__pre_learning_epochs > 0:
            self.__encoder_decoder_controller.learn_generated(feature_generator)

        learning_rate = self.__learning_rate

        encoder_best_params_list = []
        decoder_best_params_list = []
        re_encoder_best_params_list = []
        try:
            self.__change_inferencing_mode(False)
            self.__memory_tuple_list = []
            eary_stop_flag = False
            loss_list = []
            min_loss = None
            epoch = 0
            for batch_observed_arr, batch_target_arr, test_batch_observed_arr, test_batch_target_arr in feature_generator.generate():
                epoch += 1
                if ((epoch + 1) % self.__attenuate_epoch == 0):
                    learning_rate = learning_rate / self.__learning_attenuate_rate

                try:
                    _ = self.inference(batch_observed_arr)
                    delta_arr, _, loss = self.compute_retrospective_loss()

                    remember_flag = False
                    if len(loss_list) > 0:
                        if abs(loss - (sum(loss_list)/len(loss_list))) > self.__tld:
                            remember_flag = True

                    if remember_flag is True:
                        self.__remember_best_params(
                            encoder_best_params_list,
                            decoder_best_params_list,
                            re_encoder_best_params_list
                        )
                        # Re-try.
                        _ = self.inference(batch_observed_arr)
                        delta_arr, _, loss = self.compute_retrospective_loss()

                    re_encoder_grads_list, decoder_grads_list, encoder_delta_arr, encoder_grads_list = self.back_propagation(delta_arr)
                    self.optimize(
                        re_encoder_grads_list,
                        decoder_grads_list, 
                        encoder_grads_list, 
                        learning_rate, 
                        epoch
                    )

                    if min_loss is None or min_loss > loss:
                        min_loss = loss
                        
                        encoder_best_params_list = [
                            self.__encoder_decoder_controller.encoder.graph.weights_lstm_hidden_arr,
                            self.__encoder_decoder_controller.encoder.graph.weights_lstm_observed_arr,
                            self.__encoder_decoder_controller.encoder.graph.lstm_bias_arr
                        ]
                        decoder_best_params_list = [
                            self.__encoder_decoder_controller.decoder.graph.weights_lstm_hidden_arr,
                            self.__encoder_decoder_controller.decoder.graph.weights_lstm_observed_arr,
                            self.__encoder_decoder_controller.decoder.graph.lstm_bias_arr
                        ]
                        re_encoder_best_params_list = [
                            self.__retrospective_encoder.graph.weights_lstm_hidden_arr,
                            self.__retrospective_encoder.graph.weights_lstm_observed_arr,
                            self.__retrospective_encoder.graph.lstm_bias_arr
                        ]
                        self.__logger.debug("Best params are updated.")

                    self.__encoder_decoder_controller.encoder.graph.hidden_activity_arr = np.array([])
                    self.__encoder_decoder_controller.encoder.graph.cec_activity_arr = np.array([])
                    self.__encoder_decoder_controller.decoder.graph.hidden_activity_arr = np.array([])
                    self.__encoder_decoder_controller.decoder.graph.cec_activity_arr = np.array([])
                    self.__retrospective_encoder.graph.hidden_activity_arr = np.array([])
                    self.__retrospective_encoder.graph.cec_activity_arr = np.array([])

                except FloatingPointError:
                    if epoch > int(self.__epochs * 0.7):
                        self.__logger.debug(
                            "Underflow occurred when the parameters are being updated. Because of early stopping, this error is catched and the parameter is not updated."
                        )
                        eary_stop_flag = True
                        break
                    else:
                        self.__logger.debug(
                            "Underflow occurred when the parameters are being updated."
                        )
                        raise

                if self.__test_size_rate > 0:
                    self.__change_inferencing_mode(True)
                    _ = self.inference(test_batch_observed_arr)
                    _, _, test_loss = self.compute_retrospective_loss()

                    remember_flag = False
                    if len(loss_list) > 0:
                        if abs(test_loss - (sum(loss_list)/len(loss_list))) > self.__tld:
                            remember_flag = True

                    if remember_flag is True:
                        self.__remember_best_params(
                            encoder_best_params_list, 
                            decoder_best_params_list,
                            re_encoder_best_params_list
                        )
                        # Re-try.
                        _ = self.inference(test_batch_observed_arr)
                        _, _, test_loss = self.compute_retrospective_loss()

                    self.__change_inferencing_mode(False)
                    self.__verificate_retrospective_loss(loss, test_loss)

                self.__encoder_decoder_controller.encoder.graph.hidden_activity_arr = np.array([])
                self.__encoder_decoder_controller.encoder.graph.cec_activity_arr = np.array([])
                self.__encoder_decoder_controller.decoder.graph.hidden_activity_arr = np.array([])
                self.__encoder_decoder_controller.decoder.graph.cec_activity_arr = np.array([])

                if epoch > 1 and abs(loss - loss_list[-1]) < self.__tol:
                    eary_stop_flag = True
                    break
                loss_list.append(loss)

        except KeyboardInterrupt:
            self.__logger.debug("Interrupt.")

        if eary_stop_flag is True:
            self.__logger.debug("Early stopping.")
            eary_stop_flag = False
        
        self.__remember_best_params(
            encoder_best_params_list, 
            decoder_best_params_list,
            re_encoder_best_params_list
        )
        self.__change_inferencing_mode(True)
        self.__logger.debug("end. ")
110401
public static void generate() {

		// Open the GeoPackage with the feature table
		featureGeoPackage = GeoPackageManager.open(featureGeoPackageFile);

		// Check if the tile table is to be created in the same GeoPackage file
		if (featureGeoPackageFile.equals(tileGeoPackageFile)) {
			tileGeoPackage = featureGeoPackage;
		} else {

			// If the GeoPackage does not exist create it
			if (!tileGeoPackageFile.exists()) {
				if (!GeoPackageManager.create(tileGeoPackageFile)) {
					throw new GeoPackageException(
							"Failed to create GeoPackage file: "
									+ tileGeoPackageFile.getAbsolutePath());
				}
			}

			// Open the GeoPackage
			tileGeoPackage = GeoPackageManager.open(tileGeoPackageFile);
		}

		FeatureDao featureDao = featureGeoPackage.getFeatureDao(featureTable);

		// Index the feature table if needed
		FeatureTableIndex featureIndex = new FeatureTableIndex(
				featureGeoPackage, featureDao);
		if (!featureIndex.isIndexed()) {
			int numFeatures = featureDao.count();
			LOGGER.log(Level.INFO,
					"Indexing GeoPackage '" + featureGeoPackage.getName()
							+ "' feature table '" + featureTable + "' with "
							+ numFeatures + " features");
			Progress indexProgress = new Progress("Feature Indexer",
					LOG_INDEX_FREQUENCY, LOG_INDEX_TIME_FREQUENCY);
			indexProgress.setMax(numFeatures);
			featureIndex.setProgress(indexProgress);
			int indexed = featureIndex.index();
			LOGGER.log(Level.INFO,
					"Indexed GeoPackage '" + featureGeoPackage.getName()
							+ "' feature table '" + featureTable + "', "
							+ indexed + " features");
		}
		featureIndex.close();

		// Create the feature tiles
		FeatureTiles featureTiles = new DefaultFeatureTiles(featureGeoPackage,
				featureDao);
		if (ignoreGeoPackageStyles) {
			featureTiles.ignoreFeatureTableStyles();
		}
		if (maxFeaturesPerTile != null) {
			featureTiles.setMaxFeaturesPerTile(maxFeaturesPerTile);
			featureTiles.setMaxFeaturesTileDraw(new NumberFeaturesTile());
		}

		// Set the tile styles
		if (tileWidth != null) {
			featureTiles.setTileWidth(tileWidth);
		}
		if (tileHeight != null) {
			featureTiles.setTileHeight(tileHeight);
		}
		if (tileScale != null) {
			featureTiles.setScale(tileScale);
		}
		if (pointRadius != null) {
			featureTiles.setPointRadius(pointRadius);
		}
		if (pointColor != null) {
			featureTiles.setPointColor(pointColor);
		}
		if (icon != null) {
			featureTiles.setPointIcon(icon);
		}
		if (lineStrokeWidth != null) {
			featureTiles.setLineStrokeWidth(lineStrokeWidth);
		}
		if (lineColor != null) {
			featureTiles.setLineColor(lineColor);
		}
		if (polygonStrokeWidth != null) {
			featureTiles.setPolygonStrokeWidth(polygonStrokeWidth);
		}
		if (polygonColor != null) {
			featureTiles.setPolygonColor(polygonColor);
		}
		if (fillPolygon != null) {
			featureTiles.setFillPolygon(fillPolygon);
		}
		if (polygonFillColor != null) {
			featureTiles.setPolygonFillColor(polygonFillColor);
		}
		featureTiles.setSimplifyGeometries(simplifyGeometries);

		// Calculate the tile overlap with the new settings
		featureTiles.calculateDrawOverlap();

		// Default the EPSG
		if (epsg == null) {
			epsg = new Long(ProjectionConstants.EPSG_WORLD_GEODETIC_SYSTEM);
		}

		BoundingBox webMercatorBoundingBox = null;
		Projection webMercatorProjection = ProjectionFactory
				.getProjection(ProjectionConstants.EPSG_WEB_MERCATOR);

		// Set the projection and default bounding box as needed
		Projection projection = null;
		if (boundingBox != null) {

			projection = ProjectionFactory.getProjection(epsg);

			// Bound WGS84 tiles to Web Mercator limits
			if (projection.isUnit(Units.DEGREES)) {
				boundingBox = TileBoundingBoxUtils
						.boundDegreesBoundingBoxWithWebMercatorLimits(boundingBox);
			}

			// Transform to a Web Mercator bounding box
			ProjectionTransform transform = projection
					.getTransformation(webMercatorProjection);
			webMercatorBoundingBox = boundingBox.transform(transform);

		} else {
			projection = ProjectionFactory
					.getProjection(ProjectionConstants.EPSG_WORLD_GEODETIC_SYSTEM);
		}

		// Create the tile generator
		FeatureTileGenerator tileGenerator = new FeatureTileGenerator(
				tileGeoPackage, tileTable, featureTiles, featureGeoPackage,
				minZoom, maxZoom, webMercatorBoundingBox, webMercatorProjection);

		if (compressFormat != null) {
			tileGenerator.setCompressFormat(compressFormat);
			if (compressQuality != null) {
				tileGenerator.setCompressQuality(compressQuality);
			}
		}

		if (googleTiles) {
			tileGenerator.setGoogleTiles(true);
		}

		int count = tileGenerator.getTileCount();

		LOGGER.log(
				Level.INFO,
				"Feature GeoPackage: "
						+ featureGeoPackage.getName()
						+ ", Feature Table: "
						+ featureTable
						+ ", Tile GeoPackage: "
						+ tileGeoPackage.getName()
						+ ", Tile Table: "
						+ tileTable
						+ ", Min Zoom: "
						+ minZoom
						+ ", Max Zoom: "
						+ maxZoom
						+ (maxFeaturesPerTile != null ? ", Max Features Per Tile: "
								+ maxFeaturesPerTile
								: "")
						+ (compressFormat != null ? ", Compress Format: "
								+ compressFormat : "")
						+ (compressQuality != null ? ", Compress Quality: "
								+ compressQuality : "")
						+ (googleTiles ? ", Google Tiles" : "")
						+ (boundingBox != null ? ", Min Lon: "
								+ boundingBox.getMinLongitude() + ", Min Lat: "
								+ boundingBox.getMinLatitude() + ", Max Lon: "
								+ boundingBox.getMaxLongitude() + ", Max Lat: "
								+ boundingBox.getMaxLatitude() : "")
						+ (epsg != null ? ", EPSG: " + epsg : "")
						+ ", Expected Tile Count: " + count);

		StringBuilder tileStyle = new StringBuilder();
		if (tileWidth != null) {
			tileStyle.append(", Width: ").append(tileWidth);
		}
		if (tileHeight != null) {
			tileStyle.append(", Height: ").append(tileHeight);
		}
		if (pointRadius != null) {
			tileStyle.append(", Point Radius: ").append(pointRadius);
		}
		if (pointColor != null) {
			tileStyle.append(", Point Color: ").append(colorString(pointColor));
		}
		if (icon != null) {
			tileStyle.append(", Point Icon (height=").append(icon.getHeight())
					.append(", width=").append(icon.getWidth())
					.append(", xoffset=").append(icon.getXOffset())
					.append(", yoffset=").append(icon.getYOffset()).append(")");
		}
		if (lineStrokeWidth != null) {
			tileStyle.append(", Line Stroke Width: ").append(lineStrokeWidth);
		}
		if (lineColor != null) {
			tileStyle.append(", Line Color: ").append(colorString(lineColor));
		}
		if (polygonStrokeWidth != null) {
			tileStyle.append(", Polygon Stroke Width: ").append(
					polygonStrokeWidth);
		}
		if (polygonColor != null) {
			tileStyle.append(", Polygon Color: ").append(
					colorString(polygonColor));
		}
		if (fillPolygon != null && fillPolygon) {
			tileStyle.append(", Fill Polygon");
		}
		if (polygonFillColor != null) {
			tileStyle.append(", Polygon Fill Color: ").append(
					colorString(polygonFillColor));
		}
		if (simplifyGeometries) {
			tileStyle.append(", Simplify Geometries");
		}
		if (tileStyle.length() == 0) {
			tileStyle.append(", Default Settings");
		}
		LOGGER.log(Level.INFO, "Tile Attributes" + tileStyle);

		tileGenerator.setProgress(progress);

		LOGGER.log(Level.INFO, "Generating Tiles...");

		try {
			tileGenerator.generateTiles();
		} catch (IOException | SQLException e) {
			throw new GeoPackageException("Exception while generating tiles", e);
		}

		finish();
	}
106075
def features(self):
        """"""
        mycols = []
        for col in dfn.feature_names:
            if col in self:
                mycols.append(col)
        mycols.sort()
        return mycols
587609
def generate(env):
    """"""
    static_obj, shared_obj = SCons.Tool.createObjBuilders(env)

    for suffix in ASSuffixes:
        static_obj.add_action(suffix, SCons.Defaults.ASAction)
        static_obj.add_emitter(suffix, SCons.Defaults.StaticObjectEmitter)

    for suffix in ASPPSuffixes:
        static_obj.add_action(suffix, SCons.Defaults.ASPPAction)
        static_obj.add_emitter(suffix, SCons.Defaults.StaticObjectEmitter)

    env['AS']        = 'nasm'
    env['ASFLAGS']   = SCons.Util.CLVar('')
    env['ASPPFLAGS'] = '$ASFLAGS'
    env['ASCOM']     = '$AS $ASFLAGS -o $TARGET $SOURCES'
    env['ASPPCOM']   = '$CC $ASPPFLAGS $CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS -c -o $TARGET $SOURCES'
1214940
def generate_samples(self):
        """"""
        filenames = glob_all(self.args.random_data_folder, '*.wav')
        shuffle(filenames)
        while True:
            for fn in filenames:
                for x, y in self.vectors_from_fn(fn):
                    yield x, y
902023
def generate_all_deps(self, target: Target):
        """"""
        yield from (self.targets[dep_name]
                    for dep_name in self.generate_dep_names(target))
1143467
def generate_data(self, *args, **kwargs):
    """"""
    for p in self.problems:
      p.generate_data(*args, **kwargs)
93778
def _generate_features(self, feature_extractors):
        
        results = [pd.DataFrame()]
        n_ext = len(feature_extractors)

        for i, extractor in enumerate(feature_extractors):
            log.info("generating: '%s' (%d/%d)", extractor.name, i + 1, n_ext)
            cached_extractor = self._cache[extractor.name]
            if extractor.same(cached_extractor):
                log.info('pulling from cache')
                extractor = cached_extractor
            else:
                log.info('running...')
                extractor.extract()
            results.append(extractor.result)
            if self.cache_path:
                self._cache[extractor.name] = extractor

        if self.cache_path:
            with open(self.cache_path, 'wb') as f:
                pickle.dump(self._cache, f)

        return pd.concat(results, axis=1)
1123086
def generate(env):
    """"""
    for t in SCons.Tool.tool_list(env['PLATFORM'], env):
        SCons.Tool.Tool(t)(env)
1157123
def gen_properties(output, ascii_props=False, append=False):
    """"""

    files = {
        'gc': os.path.join(output, 'generalcategory.py'),
        'blk': os.path.join(output, 'block.py'),
        'sc': os.path.join(output, 'script.py'),
        'bc': os.path.join(output, 'bidiclass.py'),
        'binary': os.path.join(output, 'binary.py'),
        'posix': os.path.join(output, 'posix.py'),
        'age': os.path.join(output, 'age.py'),
        'ea': os.path.join(output, 'eastasianwidth.py'),
        'gcb': os.path.join(output, 'graphemeclusterbreak.py'),
        'lb': os.path.join(output, 'linebreak.py'),
        'sb': os.path.join(output, 'sentencebreak.py'),
        'wb': os.path.join(output, 'wordbreak.py'),
        'hst': os.path.join(output, 'hangulsyllabletype.py'),
        'dt': os.path.join(output, 'decompositiontype.py'),
        'jt': os.path.join(output, 'joiningtype.py'),
        'jg': os.path.join(output, 'joininggroup.py'),
        'nt': os.path.join(output, 'numerictype.py'),
        'nv': os.path.join(output, 'numericvalue.py'),
        'ccc': os.path.join(output, 'canonicalcombiningclass.py'),
        'qc': os.path.join(output, 'quickcheck.py'),
        'alias': os.path.join(output, 'alias.py')
    }

    files['scx'] = os.path.join(output, 'scriptextensions.py')
    files['insc'] = os.path.join(output, 'indicsyllabiccategory.py')
    if PY34:
        files['bpt'] = os.path.join(output, 'bidipairedbrackettype.py')
    if PY35:
        files['inpc'] = os.path.join(output, 'indicpositionalcategory.py')
    else:
        files['inmc'] = os.path.join(output, 'indicmatracategory.py')
    if PY37:
        files['vo'] = os.path.join(output, 'verticalorientation.py')

    prefix = "ascii" if ascii_props else 'unicode'

    # `L&` or `Lc` won't be found in the table,
    # so initialize 'c' at the start. `&` will have to be converted to 'c'
    # before sending it through.
    categories = [
        'generalcategory', 'script', 'block',
        'bidiclass', 'eastasianwidth', 'linebreak',
        'hangulsyllabletype', 'wordbreak', 'sentencebreak',
        'graphemeclusterbreak', 'decompositiontype', 'joiningtype',
        'joininggroup', 'numerictype', 'numericvalue',
        'canonicalcombiningclass', 'age'
    ]
    categories.append('scriptextensions')
    categories.append('indicsyllabiccategory')
    if PY34:
        categories.append('bidipairedbrackettype')
    if PY35:
        categories.append('indicpositionalcategory')
    else:
        categories.append('indicmatracategory')
    if PY37:
        categories.append('verticalorientation')
    if ascii_props:
        print('=========Ascii Tables=========')
    else:
        print('========Unicode Tables========')
    print('Building: General Category')
    max_range = ASCII_RANGE if ascii_props else UNICODE_RANGE
    all_chars = ALL_ASCII if ascii_props else ALL_CHARS
    table = {'l': {'c': []}}
    itable = {'l': {}}
    with codecs.open(os.path.join(HOME, 'unicodedata', UNIVERSION, 'UnicodeData.txt'), 'r', 'utf-8') as uf:
        for line in uf:
            data = line.strip().split(';')
            if data:
                i = int(data[0], 16)
                if i > max_range[1]:
                    continue
                p = data[2].lower()
                if p[0] not in table:
                    table[p[0]] = {}
                    itable[p[0]] = {}
                if p[1] not in table[p[0]]:
                    table[p[0]][p[1]] = []
                table[p[0]][p[1]].append(i)
                # Add LC which is a combo of Ll, Lu, and Lt
                if p[0] == 'l' and p[1] in ('l', 'u', 't'):
                    table['l']['c'].append(i)

    # Create inverse of each category
    for k1, v1 in table.items():
        inverse_category = set()
        for k2, v2 in v1.items():
            s = set(v2)
            inverse_category |= s
        itable[k1]['^'] = list(all_chars - inverse_category)

    # Generate Unicode blocks
    print('Building: Blocks')
    gen_blocks(files['blk'], ascii_props, append, prefix)

    # Generate Unicode scripts
    print('Building: Scripts & Script Extensions')
    gen_scripts(
        'Scripts.txt', 'ScriptExtensions.txt', 'scripts', 'script_extensions', files['sc'], files['scx'],
        notexplicit='zzzz', ascii_props=ascii_props, append=append, prefix=prefix
    )

    # Generate Unicode bidi classes
    print('Building: Bidi Classes')
    gen_bidi(files['bc'], ascii_props, append, prefix)

    if PY34:
        print('Building: Bidi Paired Bracket Type')
        gen_enum(
            'BidiBrackets.txt', 'bidi_paired_bracket_type', files['bpt'], notexplicit='n',
            field=2, ascii_props=ascii_props, append=append, prefix=prefix
        )

    # Generate Unicode binary
    print('Building: Binary')
    binary = gen_binary(table, files['binary'], ascii_props, append, prefix)

    # Generate posix table and write out to file.
    print('Building: Posix')
    gen_posix(files['posix'], is_bytes=ascii_props, append=append, prefix=prefix)

    print('Building: Age')
    gen_age(files['age'], ascii_props, append, prefix)

    print('Building: East Asian Width')
    gen_enum(
        'EastAsianWidth.txt', 'east_asian_width', files['ea'],
        notexplicit='n', ascii_props=ascii_props, append=append, prefix=prefix
    )

    print('Building: Grapheme Cluster Break')
    gen_enum(
        'GraphemeBreakProperty.txt', 'grapheme_cluster_break', files['gcb'], notexplicit='other',
        ascii_props=ascii_props, append=append, prefix=prefix
    )

    print('Building: Line Break')
    gen_enum(
        'LineBreak.txt', 'line_break', files['lb'], notexplicit='unknown',
        ascii_props=ascii_props, append=append, prefix=prefix
    )

    print('Building: Sentence Break')
    gen_enum(
        'SentenceBreakProperty.txt', 'sentence_break', files['sb'], notexplicit='other',
        ascii_props=ascii_props, append=append, prefix=prefix
    )

    print('Building: Word Break')
    gen_enum(
        'WordBreakProperty.txt', 'word_break', files['wb'], notexplicit='other',
        ascii_props=ascii_props, append=append, prefix=prefix
    )

    if PY35:
        print('Building: Indic Positional Category')
        gen_enum(
            'IndicPositionalCategory.txt', 'indic_positional_category', files['inpc'], notexplicit='na',
            ascii_props=ascii_props, append=append, prefix=prefix
        )
    else:
        print('Building: Indic Matra Category')
        gen_enum(
            'IndicMatraCategory.txt', 'indic_matra_category', files['inmc'], notexplicit='na',
            ascii_props=ascii_props, append=append, prefix=prefix
        )
    print('Building: Indic Syllabic Category')
    gen_enum(
        'IndicSyllabicCategory.txt', 'indic_syllabic_category', files['insc'], notexplicit='other',
        ascii_props=ascii_props, append=append, prefix=prefix
    )

    print('Building: Hangul Syllable Type')
    gen_enum(
        'HangulSyllableType.txt', 'hangul_syllable_type', files['hst'], notexplicit='na',
        ascii_props=ascii_props, append=append, prefix=prefix
    )

    print('Building: Decomposition Type')
    gen_enum(
        'DerivedDecompositionType.txt', 'decomposition_type', files['dt'], notexplicit='none',
        ascii_props=ascii_props, append=append, prefix=prefix
    )

    print('Building: Joining Type')
    gen_enum(
        'DerivedJoiningType.txt', 'joining_type', files['jt'], notexplicit='u',
        ascii_props=ascii_props, append=append, prefix=prefix
    )

    print('Building: Joining Group')
    gen_enum(
        'DerivedJoiningGroup.txt', 'joining_group', files['jg'], notexplicit='nonjoining',
        ascii_props=ascii_props, append=append, prefix=prefix
    )

    print('Building: Numeric Type')
    gen_enum(
        'DerivedNumericType.txt', 'numeric_type', files['nt'], notexplicit='none',
        ascii_props=ascii_props, append=append, prefix=prefix
    )

    print('Building: Numeric Value')
    gen_enum(
        'DerivedNumericValues.txt', 'numeric_values', files['nv'], field=3, notexplicit='nan',
        ascii_props=ascii_props, append=append, prefix=prefix
    )

    print('Building: Canonical Combining Class')
    gen_ccc(files['ccc'], ascii_props, append, prefix)

    print('Building: NF* Quick Check')
    categories.extend(gen_nf_quick_check(files['qc'], ascii_props, append, prefix))

    if PY37:
        print('Building: Vertical Orientation')
        gen_enum(
            'VerticalOrientation.txt', 'vertical_orientation', files['vo'], notexplicit='R',
            ascii_props=ascii_props, append=append, prefix=prefix
        )

    if not ascii_props:
        print('Building: Aliases')
        gen_alias(categories, binary, files['alias'], ascii_props, append, prefix)

    # Convert char values to string ranges.
    char2range(table, is_bytes=ascii_props)
    char2range(itable, is_bytes=ascii_props, invert=False)
    for k1, v1 in itable.items():
        table[k1]['^'] = v1['^']

    with codecs.open(files['gc'], 'a' if append else 'w', 'utf-8') as f:
        if not append:
            f.write(HEADER)
        # Write out the Unicode properties
        f.write('%s_properties = {\n' % prefix)
        count = len(table) - 1
        i = 0
        for k1, v1 in sorted(table.items()):
            f.write('    "%s": {\n' % k1)
            count2 = len(v1) - 1
            j = 0
            for k2, v2 in sorted(v1.items()):
                f.write('        "%s": "%s"' % (k2, v2))
                if j == count2:
                    f.write('\n    }')
                else:
                    f.write(',\n')
                j += 1
            if i == count:
                f.write('\n}\n')
            else:
                f.write(',\n')
            i += 1

    if not append:
        with codecs.open(os.path.join(output, '__init__.py'), 'w') as f:
            f.write(HEADER)
            for x in sorted(files):
                f.write('from .%s import *  # noqa\n' % os.path.basename(files[x])[:-3])
455690
def _gen_tasks(self):
        """"""
        for filename in self.args:
            path = os.path.abspath(filename)
            yield {
                'name': path,
                # 'file_dep': [path],
                'actions': [(self.fun, (filename,))],
            }