public ValidCdxProcessingFixture(OsdrTestHarness harness)
        {
            BlobId = harness.JohnBlobStorageClient.AddResource(harness.JohnId.ToString(), "125_11Mos.cdx", new Dictionary <string, object>()
            {
                { "parentId", harness.JohnId }
            }).Result;

            FileId = harness.WaitWhileRecordsFileProcessed(BlobId);
        }
Esempio n. 2
0
        public InvalidCifProcessingFixture(OsdrTestHarness harness)
        {
            BlobId = harness.JohnBlobStorageClient.AddResource(harness.JohnId.ToString(), "1100110_modified.cif", new Dictionary <string, object>()
            {
                { "parentId", harness.JohnId }
            }).Result;

            FileId = harness.WaitWhileRecordsFileProcessed(BlobId);
        }
Esempio n. 3
0
        public InvalidSdfProcessingFixture(OsdrTestHarness harness)
        {
            BlobId = harness.JohnBlobStorageClient.AddResource(harness.JohnId.ToString(), "invalid_sdf_with_20_records_where_first_and_second_are_invalid.sdf", new Dictionary <string, object>()
            {
                { "parentId", harness.JohnId }
            }).Result;

            FileId = harness.WaitWhileRecordsFileProcessed(BlobId);
        }
Esempio n. 4
0
        public ReadEventsBackwardAsyncFixture(OsdrTestHarness harness)
        {
            BlobId = harness.JohnBlobStorageClient.AddResource(harness.JohnId.ToString(), "Aspirin.mol", new Dictionary <string, object>()
            {
                { "parentId", harness.JohnId }
            }).Result;

            FileId = harness.WaitWhileRecordsFileProcessed(BlobId);
        }
        public SdfProcessingWithOneValidAndOneInvalidRecordsFixture(OsdrTestHarness harness)
        {
            BlobId = harness.JohnBlobStorageClient.AddResource(harness.JohnId.ToString(), "test_solubility.sdf", new Dictionary <string, object>()
            {
                { "parentId", harness.JohnId }
            }).Result;

            FileId = harness.WaitWhileRecordsFileProcessed(BlobId);
        }
        public static async Task <Guid> TrainModel(this OsdrTestHarness harness, string bucket, string fileName, IDictionary <string, object> metadata = null)
        {
            var blobId = await harness.JohnBlobStorageClient.AddResource(bucket, fileName, metadata);

            //var blobId = await harness.AddBlob(harness.JohnId.ToString(), fileName, metadata);

            harness.WaitWhileRecordsFileProcessed(blobId);

            var modelFolderId = NewId.NextGuid();

            if (metadata["case"].Equals("valid one model with success optimization") || metadata["case"].Equals("train model with failed optimization"))
            {
                await harness.BusControl.Publish <StartTraining>(new
                {
                    Id             = modelFolderId,
                    ParentId       = modelFolderId,
                    SourceBlobId   = blobId,
                    SourceBucket   = bucket,
                    CorrelationId  = NewId.NextGuid(),
                    UserId         = harness.JohnId,
                    SourceFileName = fileName,
                    Methods        = new List <string>(new[]
                    {
                        "NaiveBayes"
                    }),
                    ClassName = "ClassName",
                    Optimize  = true
                });
            }
            else if (metadata["case"].Equals("two valid models"))
            {
                await harness.BusControl.Publish <StartTraining>(new
                {
                    Id             = modelFolderId,
                    ParentId       = modelFolderId,
                    SourceBlobId   = blobId,
                    SourceBucket   = bucket,
                    CorrelationId  = NewId.NextGuid(),
                    UserId         = harness.JohnId,
                    SourceFileName = fileName,
                    Scaler         = "Somebody knows what is Scaler???",
                    Methods        = new List <string>(new[]
                    {
                        "NaiveBayes",
                        "LogisticRegression"
                    }),
                    ClassName     = "ClassName",
                    SubSampleSize = (decimal)0.2,
                    TestDataSize  = (decimal)0.2,
                    KFold         = 4,
                    Fingerprints  = new List <IDictionary <string, object> >()
                    {
                        new Dictionary <string, object>()
                        {
                            { "radius", 3 },
                            { "size", 1024 },
                            { "type", FingerprintType.ecfp }
                        }
                    },
                    Optimize = false
                });
            }
            else
            {
                await harness.BusControl.Publish <StartTraining>(new
                {
                    Id             = modelFolderId,
                    ParentId       = modelFolderId,
                    SourceBlobId   = blobId,
                    SourceBucket   = bucket,
                    CorrelationId  = NewId.NextGuid(),
                    UserId         = harness.JohnId,
                    SourceFileName = fileName,
                    Scaler         = "Somebody knows what is Scaler???",
                    Methods        = new List <string>(new[]
                    {
                        "NaiveBayes"
                    }),
                    ClassName     = "ClassName",
                    SubSampleSize = (decimal)0.2,
                    TestDataSize  = (decimal)0.2,
                    KFold         = 4,
                    Fingerprints  = new List <IDictionary <string, object> >()
                    {
                        new Dictionary <string, object>()
                        {
                            { "radius", 3 },
                            { "size", 1024 },
                            { "type", FingerprintType.ecfp }
                        }
                    },
                    Optimize = false
                });
            }

            if (!harness.Received.Select <MachineLearning.Domain.Events.TrainingFinished>(m => m.Context.Message.Id == modelFolderId).Any())
            {
                throw new TimeoutException();
            }

            return(modelFolderId);
        }