ForeignKeys { public static VectorModel trainLogisticRegressionModel( MetadataStore store, ConstraintCollection<InclusionDependency> foreignKeyCC, ConstraintCollection<InclusionDependency> indCC, ConstraintCollection<ColumnStatistics> columnStatisticCC, ConstraintCollection<TextColumnStatistics> textColumnStatisticCC, ConstraintCollection<TableSample> tableSampleCC, ConstraintCollection<UniqueColumnCombination> uniqueCC) { Collection<Observation<InclusionDependency>> trainingSet = createTrainingSet(store, foreignKeyCC, indCC, columnStatisticCC, textColumnStatisticCC, tableSampleCC, uniqueCC); trainingSet = oversample(trainingSet); return LogisticRegression.train(trainingSet, features.length - 1, 1d, 5, 0.0001); }  static Collection<Observation<InclusionDependency>> createTrainingSet(
            MetadataStore store,
            ConstraintCollection<InclusionDependency> foreignKeyCC,
            ConstraintCollection<InclusionDependency> indCC,
            ConstraintCollection<ColumnStatistics> columnStatisticCC,
            ConstraintCollection<TextColumnStatistics> textColumnStatisticCC,
            ConstraintCollection<TableSample> tableSampleCC,
            ConstraintCollection<UniqueColumnCombination> uniqueCC); static Collection<Instance<InclusionDependency>> createEstimationSet(
            MetadataStore store,
            ConstraintCollection<InclusionDependency> indCC,
            ConstraintCollection<ColumnStatistics> columnStatisticCC,
            ConstraintCollection<TextColumnStatistics> textColumnStatisticCC,
            ConstraintCollection<TableSample> tableSampleCC); static Collection<Observation<T>> oversample(
            Collection<Observation<T>> instances); static VectorModel trainLogisticRegressionModel(
            MetadataStore store,
            ConstraintCollection<InclusionDependency> foreignKeyCC,
            ConstraintCollection<InclusionDependency> indCC,
            ConstraintCollection<ColumnStatistics> columnStatisticCC,
            ConstraintCollection<TextColumnStatistics> textColumnStatisticCC,
            ConstraintCollection<TableSample> tableSampleCC,
            ConstraintCollection<UniqueColumnCombination> uniqueCC); static Collection<Prediction<InclusionDependency, Double>> estimateForeignKeyProbability(
            MetadataStore store,
            ConstraintCollection<InclusionDependency> indCC,
            ConstraintCollection<ColumnStatistics> columnStatisticCC,
            ConstraintCollection<TextColumnStatistics> textColumnStatisticCC,
            ConstraintCollection<TableSample> tableSampleCC,
            VectorModel logisticRegressionModel); static Collection<InclusionDependency> estimateForeignKeys(
            MetadataStore store,
            ConstraintCollection<InclusionDependency> indCC,
            ConstraintCollection<UniqueColumnCombination> uccCC,
            ConstraintCollection<ColumnStatistics> columnStatisticCC,
            ConstraintCollection<TextColumnStatistics> textColumnStatisticCC,
            ConstraintCollection<TableSample> tableSampleCC,
            VectorModel logisticRegressionModel); static Collection<InclusionDependency> estimateForeignKeys(
            MetadataStore store,
            ConstraintCollection<InclusionDependency> indCC,
            ConstraintCollection<UniqueColumnCombination> uccCC,
            ConstraintCollection<ColumnStatistics> columnStatisticCC,
            ConstraintCollection<TextColumnStatistics> textColumnStatisticCC,
            ConstraintCollection<TableSample> tableSampleCC,
            VectorModel logisticRegressionModel,
            double minFkProbability); static final String[] features; }
@Test public void testCreateTrainingSetOnRealWorldMetadataDoesNotFail() throws SQLException { File file = new File(Thread.currentThread().getContextClassLoader().getResource("biosql.db").getFile()); SQLiteInterface sqliteInterface = SQLiteInterface.createForFile(file); MetadataStore store = RDBMSMetadataStore.load(sqliteInterface); VectorModel vectorModel = ForeignKeys.trainLogisticRegressionModel( store, store.getConstraintCollection("sql-foreign-keys"), store.getConstraintCollection("metanome-inds"), store.getConstraintCollection("metanome-column-stats"), store.getConstraintCollection("metanome-text-stats"), store.getConstraintCollection("table-samples-100"), store.getConstraintCollection("sql-primary-keys") ); System.out.println(vectorModel); }