%3CLINGO-SUB%20id%3D%22lingo-sub-1201319%22%20slang%3D%22en-US%22%3EData%20Drift%20in%20Azure%20Machine%20Learning%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1201319%22%20slang%3D%22en-US%22%3E%3CP%3EIn%20this%20new%20age%20of%20collaboration%20including%20a%20more%20refined%20focus%20on%20Data%20Engineering%2C%20Data%20Science%20Engineering%2C%20and%20AI%20Engineering%20it%20becomes%20necessary%20to%20be%20clear%20that%20the%20choppy%20%E2%80%9Cswim-lanes%E2%80%9D%20of%20responsibility%20have%20become%20even%20more%20blurred.%20%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FP%3E%0A%3CP%3EIn%20this%20short%20post%2C%20I%20wanted%20to%20cover%20a%20new%20feature%20in%20the%20Azure%20Machine%20Learning%20Studio%20named%2C%20Data%20Drift%20Detection.%26nbsp%3B%20Data%20Drift%20for%20this%20article%20i%3CSPAN%20style%3D%22display%3A%20inline%20!important%3B%20float%3A%20none%3B%20background-color%3A%20%23ffffff%3B%20color%3A%20%23171717%3B%20font-family%3A%20Segoe%20UI%2CSegoeUI%2CSegoe%20WP%2CHelvetica%20Neue%2CHelvetica%2CTahoma%2CArial%2Csans-serif%3B%20font-size%3A%2016px%3B%20font-style%3A%20normal%3B%20font-variant%3A%20normal%3B%20font-weight%3A%20400%3B%20letter-spacing%3A%20normal%3B%20orphans%3A%202%3B%20overflow-wrap%3A%20break-word%3B%20text-align%3A%20left%3B%20text-decoration%3A%20none%3B%20text-indent%3A%200px%3B%20text-transform%3A%20none%3B%20-webkit-text-stroke-width%3A%200px%3B%20white-space%3A%20normal%3B%20word-spacing%3A%200px%3B%22%3Es%20the%20change%20in%20model%20input%20data%20that%20leads%20to%20model%20performance%20degradation.%20It%20is%20one%20of%20the%20top%20reasons%20where%20model%20accuracy%20degrades%20over%20time%2C%20thus%20monitoring%20data%20drift%20helps%20detect%20model%20performance%20issues.%20%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ESome%20major%20causes%20of%20data%20drift%20may%20include%3A%26nbsp%3B%3C%2FP%3E%0A%3CP%20style%3D%22box-sizing%3A%20inherit%3B%20color%3A%20%23171717%3B%20font-family%3A%20Segoe%20UI%2CSegoeUI%2CSegoe%20WP%2CHelvetica%20Neue%2CHelvetica%2CTahoma%2CArial%2Csans-serif%3B%20font-size%3A%2016px%3B%20font-style%3A%20normal%3B%20font-variant%3A%20normal%3B%20font-weight%3A%20400%3B%20letter-spacing%3A%20normal%3B%20orphans%3A%202%3B%20overflow-wrap%3A%20break-word%3B%20text-align%3A%20left%3B%20text-decoration%3A%20none%3B%20text-indent%3A%200px%3B%20text-transform%3A%20none%3B%20-webkit-text-stroke-width%3A%200px%3B%20white-space%3A%20normal%3B%20word-spacing%3A%200px%3B%20padding%3A%200px%3B%20margin%3A%201rem%200px%200px%200px%3B%22%3ECauses%20of%20data%20drift%20include%3A%3C%2FP%3E%0A%3CUL%20style%3D%22box-sizing%3A%20inherit%3B%20color%3A%20%23171717%3B%20font-family%3A%20Segoe%20UI%2CSegoeUI%2CSegoe%20WP%2CHelvetica%20Neue%2CHelvetica%2CTahoma%2CArial%2Csans-serif%3B%20font-size%3A%2016px%3B%20font-style%3A%20normal%3B%20font-variant%3A%20normal%3B%20font-weight%3A%20400%3B%20letter-spacing%3A%20normal%3B%20list-style-image%3A%20none%3B%20list-style-position%3A%20outside%3B%20list-style-type%3A%20none%3B%20orphans%3A%202%3B%20text-align%3A%20left%3B%20text-decoration%3A%20none%3B%20text-indent%3A%200px%3B%20text-transform%3A%20none%3B%20-webkit-text-stroke-width%3A%200px%3B%20white-space%3A%20normal%3B%20word-spacing%3A%200px%3B%20padding%3A%200px%3B%20margin%3A%2016px%200px%2016px%2038px%3B%22%3E%0A%3CLI%20style%3D%22box-sizing%3A%20inherit%3B%20list-style-image%3A%20none%3B%20list-style-position%3A%20outside%3B%20list-style-type%3A%20disc%3B%20outline-color%3A%20invert%3B%20outline-style%3A%20none%3B%20outline-width%3A%200px%3B%20padding%3A%200px%3B%20margin%3A%200px%3B%22%3EUpstream%20process%20changes%2C%20such%20as%20a%20sensor%20being%20replaced%20that%20change%20the%20unit%20of%20measure%20being%20applied.%26nbsp%3B%20Maybe%20from%20Imperial%20to%20Metric%3F%3C%2FLI%3E%0A%3CLI%20style%3D%22box-sizing%3A%20inherit%3B%20list-style-image%3A%20none%3B%20list-style-position%3A%20outside%3B%20list-style-type%3A%20disc%3B%20outline-color%3A%20invert%3B%20outline-style%3A%20none%3B%20outline-width%3A%200px%3B%20padding%3A%200px%3B%20margin%3A%200px%3B%22%3EData%20quality%20issues%2C%20such%20as%20a%20failed%20deployment%20of%20a%20patch%20for%20a%20software%20component%20or%20a%20failed%20sensor%20reading%200.%3C%2FLI%3E%0A%3CLI%20style%3D%22box-sizing%3A%20inherit%3B%20list-style-image%3A%20none%3B%20list-style-position%3A%20outside%3B%20list-style-type%3A%20disc%3B%20outline-color%3A%20invert%3B%20outline-style%3A%20none%3B%20outline-width%3A%200px%3B%20padding%3A%200px%3B%20margin%3A%200px%3B%22%3ENatural%20drift%20in%20the%20data%2C%20such%20as%20mean%20temperature%20changing%20with%20the%20seasons%20or%20deprecated%20interface%20features%20no%20longer%20being%20utilized.%3C%2FLI%3E%0A%3CLI%20style%3D%22box-sizing%3A%20inherit%3B%20list-style-image%3A%20none%3B%20list-style-position%3A%20outside%3B%20list-style-type%3A%20disc%3B%20outline-color%3A%20invert%3B%20outline-style%3A%20none%3B%20outline-width%3A%200px%3B%20padding%3A%200px%3B%20margin%3A%200px%3B%22%3EChange%20in%20relation%20between%20features%2C%20or%20covariate%20shift.%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3EWith%20the%20use%20of%20Dataset%20monitors%20in%20Azure%20Machine%20Learning%20studio%2C%20your%20organization%20is%20able%20to%20setup%20alerts%20to%20assist%20in%20the%20detection%20of%20data%20drift%20which%20can%20be%20useful%20in%20helping%20you%20maintain%20a%20healthy%20and%20accurate%20Machine%20Learning%20Model%20in%20your%20deployments.%20%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThere%20are%203%20primary%20scenarios%20for%20setting%20up%20dataset%20monitors%20in%20%3CA%20href%3D%22http%3A%2F%2FScenario%2520Description%20Monitoring%20a%20model's%20serving%20data%20for%20drift%20from%20the%20model's%20training%20data%20Results%20from%20this%20scenario%20can%20be%20interpreted%20as%20monitoring%20a%20proxy%20for%20the%20model's%20accuracy%2C%20given%20that%20model%20accuracy%20degrades%20if%20the%20serving%20data%20drifts%20from%20the%20training%20data.%20Monitoring%20a%20time%20series%20dataset%20for%20drift%20from%20a%20previous%20time%20period.%20This%20scenario%20is%20more%20general%2C%20and%20can%20be%20used%20to%20monitor%20datasets%20involved%20upstream%20or%20downstream%20of%20model%20building.%20The%20target%20dataset%20must%20have%20a%20timestamp%20column%2C%20while%20the%20baseline%20dataset%20can%20be%20any%20tabular%20dataset%20that%20has%20features%20in%20common%20with%20the%20target%20dataset.%20Performing%20analysis%20on%20past%20data.%20This%20scenario%20can%20be%20used%20to%20understand%20historical%20data%20and%20inform%20decisions%20in%20settings%20for%20dataset%20monitors.%22%20target%3D%22_self%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3EAzure%20Machine%20Learning%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CTABLE%20class%3D%22table%22%20style%3D%22border-collapse%3A%20collapse%3B%20border-spacing%3A%200px%3B%20box-sizing%3A%20inherit%3B%20color%3A%20%23171717%3B%20font-family%3A%20Segoe%20UI%2CSegoeUI%2CSegoe%20WP%2CHelvetica%20Neue%2CHelvetica%2CTahoma%2CArial%2Csans-serif%3B%20font-size%3A%200.87rem%3B%20font-style%3A%20normal%3B%20font-variant%3A%20normal%3B%20font-weight%3A%20400%3B%20letter-spacing%3A%20normal%3B%20orphans%3A%202%3B%20table-layout%3A%20auto%3B%20text-align%3A%20left%3B%20text-decoration%3A%20none%3B%20text-indent%3A%200px%3B%20text-transform%3A%20none%3B%20-webkit-text-stroke-width%3A%200px%3B%20white-space%3A%20normal%3B%20width%3A%20100%25%3B%20word-spacing%3A%200px%3B%22%3E%0A%3CTHEAD%20style%3D%22box-sizing%3A%20inherit%3B%22%3E%0A%3CTR%20style%3D%22box-sizing%3A%20inherit%3B%22%3E%0A%3CTH%20style%3D%22border-top%3A%201px%20solid%20var(--border)%3B%20box-sizing%3A%20inherit%3B%20display%3A%20table-cell%3B%20line-height%3A%201.5%3B%20overflow-wrap%3A%20break-word%3B%20text-align%3A%20left%3B%20vertical-align%3A%20bottom%3B%20border-width%3A%200px%200px%201px%200px%3B%20border-color%3A%20currentColor%3B%20border-style%3A%20none%20solid%20none%20solid%3B%20padding%3A%200.75rem%201rem%200.75rem%201rem%3B%22%3EScenario%3C%2FTH%3E%0A%3CTH%20style%3D%22border-top%3A%201px%20solid%20var(--border)%3B%20box-sizing%3A%20inherit%3B%20display%3A%20table-cell%3B%20line-height%3A%201.5%3B%20overflow-wrap%3A%20break-word%3B%20text-align%3A%20left%3B%20vertical-align%3A%20bottom%3B%20border-width%3A%200px%200px%201px%200px%3B%20border-color%3A%20currentColor%3B%20border-style%3A%20none%20solid%20none%20solid%3B%20padding%3A%200.75rem%201rem%200.75rem%201rem%3B%22%3EDescription%3C%2FTH%3E%0A%3C%2FTR%3E%0A%3C%2FTHEAD%3E%0A%3CTBODY%20style%3D%22box-sizing%3A%20inherit%3B%22%3E%0A%3CTR%20style%3D%22box-sizing%3A%20inherit%3B%22%3E%0A%3CTD%20style%3D%22border-top%3A%201px%20solid%20var(--border)%3B%20box-sizing%3A%20inherit%3B%20display%3A%20table-cell%3B%20line-height%3A%201.5%3B%20overflow-wrap%3A%20break-word%3B%20text-align%3A%20left%3B%20vertical-align%3A%20top%3B%20border-width%3A%201px%200px%200px%200px%3B%20border-color%3A%20hsla(0%2C%200%25%2C%2089%25%2C%201)%20currentColor%20currentColor%20currentColor%3B%20border-style%3A%20solid%3B%20padding%3A%200.75rem%201rem%200.75rem%201rem%3B%22%3EMonitoring%20a%20model's%20serving%20data%20for%20drift%20from%20the%20model's%20training%20data%3C%2FTD%3E%0A%3CTD%20style%3D%22border-top%3A%201px%20solid%20var(--border)%3B%20box-sizing%3A%20inherit%3B%20display%3A%20table-cell%3B%20line-height%3A%201.5%3B%20overflow-wrap%3A%20break-word%3B%20text-align%3A%20left%3B%20vertical-align%3A%20top%3B%20border-width%3A%201px%200px%200px%200px%3B%20border-color%3A%20hsla(0%2C%200%25%2C%2089%25%2C%201)%20currentColor%20currentColor%20currentColor%3B%20border-style%3A%20solid%3B%20padding%3A%200.75rem%201rem%200.75rem%201rem%3B%22%3EResults%20from%20this%20scenario%20can%20be%20interpreted%20as%20monitoring%20a%20proxy%20for%20the%20model's%20accuracy%2C%20given%20that%20model%20accuracy%20degrades%20if%20the%20serving%20data%20drifts%20from%20the%20training%20data.%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3CTR%20style%3D%22box-sizing%3A%20inherit%3B%22%3E%0A%3CTD%20style%3D%22border-top%3A%201px%20solid%20var(--border)%3B%20box-sizing%3A%20inherit%3B%20display%3A%20table-cell%3B%20line-height%3A%201.5%3B%20overflow-wrap%3A%20break-word%3B%20text-align%3A%20left%3B%20vertical-align%3A%20top%3B%20border-width%3A%201px%200px%200px%200px%3B%20border-color%3A%20hsla(0%2C%200%25%2C%2089%25%2C%201)%20currentColor%20currentColor%20currentColor%3B%20border-style%3A%20solid%3B%20padding%3A%200.75rem%201rem%200.75rem%201rem%3B%22%3EMonitoring%20a%20time%20series%20dataset%20for%20drift%20from%20a%20previous%20time%20period.%3C%2FTD%3E%0A%3CTD%20style%3D%22border-top%3A%201px%20solid%20var(--border)%3B%20box-sizing%3A%20inherit%3B%20display%3A%20table-cell%3B%20line-height%3A%201.5%3B%20overflow-wrap%3A%20break-word%3B%20text-align%3A%20left%3B%20vertical-align%3A%20top%3B%20border-width%3A%201px%200px%200px%200px%3B%20border-color%3A%20hsla(0%2C%200%25%2C%2089%25%2C%201)%20currentColor%20currentColor%20currentColor%3B%20border-style%3A%20solid%3B%20padding%3A%200.75rem%201rem%200.75rem%201rem%3B%22%3EThis%20scenario%20is%20more%20general%2C%20and%20can%20be%20used%20to%20monitor%20datasets%20involved%20upstream%20or%20downstream%20of%20model%20building.%20The%20target%20dataset%20must%20have%20a%20timestamp%20column%2C%20while%20the%20baseline%20dataset%20can%20be%20any%20tabular%20dataset%20that%20has%20features%20in%20common%20with%20the%20target%20dataset.%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3CTR%20style%3D%22box-sizing%3A%20inherit%3B%22%3E%0A%3CTD%20style%3D%22border-top%3A%201px%20solid%20var(--border)%3B%20box-sizing%3A%20inherit%3B%20display%3A%20table-cell%3B%20line-height%3A%201.5%3B%20overflow-wrap%3A%20break-word%3B%20text-align%3A%20left%3B%20vertical-align%3A%20top%3B%20border-width%3A%201px%200px%200px%200px%3B%20border-color%3A%20hsla(0%2C%200%25%2C%2089%25%2C%201)%20currentColor%20currentColor%20currentColor%3B%20border-style%3A%20solid%3B%20padding%3A%200.75rem%201rem%200.75rem%201rem%3B%22%3EPerforming%20analysis%20on%20past%20data.%3C%2FTD%3E%0A%3CTD%20style%3D%22border-top%3A%201px%20solid%20var(--border)%3B%20box-sizing%3A%20inherit%3B%20display%3A%20table-cell%3B%20line-height%3A%201.5%3B%20overflow-wrap%3A%20break-word%3B%20text-align%3A%20left%3B%20vertical-align%3A%20top%3B%20border-width%3A%201px%200px%200px%200px%3B%20border-color%3A%20hsla(0%2C%200%25%2C%2089%25%2C%201)%20currentColor%20currentColor%20currentColor%3B%20border-style%3A%20solid%3B%20padding%3A%200.75rem%201rem%200.75rem%201rem%3B%22%3EThis%20scenario%20can%20be%20used%20to%20understand%20historical%20data%20and%20inform%20decisions%20in%20settings%20for%20dataset%20monitors.%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3C%2FTBODY%3E%0A%3C%2FTABLE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EYour%20dataset%20will%20require%20a%20timestamp%3B%20however%2C%20once%20you%20have%20a%20baseline%20dataset%20defined%20-%20your%20target%20dataset%20or%20incoming%20model%20input%20will%20be%20compared%20on%20the%20intervals%20specified%20to%20help%20your%20system%20become%20more%20proactive.%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EUsing%20the%20azureml%20SDK%20you%20would%20execute%20the%20following%20code%20to%20create%20a%20workspace%20(your%20Azure%20Machine%20Learning%20workspace)%2C%20your%20originating%20Datastore%2C%20and%20the%20Dataset%20you%20wish%20to%20monitor.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-markup%22%3E%3CCODE%3Efrom%20azureml.core%20import%20Workspace%2C%20Dataset%2C%20Datastore%0A%0A%23%20get%20workspace%20object%0Aws%20%3D%20Workspace.from_config()%0A%0A%23%20get%20datastore%20object%20%0Adstore%20%3D%20Datastore.get(ws%2C%20'your%20datastore%20name')%0A%0A%23%20specify%20datastore%20paths%0Adstore_paths%20%3D%20%5B(dstore%2C%20'weather%2F*%2F*%2F*%2F*%2Fdata.parquet')%5D%0A%0A%23%20specify%20partition%20format%0Apartition_format%20%3D%20'weather%2F%7Bstate%7D%2F%7Bdate%3Ayyyy%2FMM%2Fdd%7D%2Fdata.parquet'%0A%0A%23%20create%20the%20Tabular%20dataset%20with%20'state'%20and%20'date'%20as%20virtual%20columns%20%0Adset%20%3D%20Dataset.Tabular.from_parquet_files(path%3Ddstore_paths%2C%20partition_format%3Dpartition_format)%0A%0A%23%20assign%20the%20timestamp%20attribute%20to%20a%20real%20or%20virtual%20column%20in%20the%20dataset%0Adset%20%3D%20dset.with_timestamp_columns('date')%0A%0A%23%20register%20the%20dataset%20as%20the%20target%20dataset%0Adset%20%3D%20dset.register(ws%2C%20'target')%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EOnce%20this%20is%20established%20you%20can%20build%20a%20dataset%20monitor%20to%20detect%20drift%20with%20the%20delta%20range%20you%20provide%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-markup%22%3E%3CCODE%3Efrom%20azureml.core%20import%20Workspace%2C%20Dataset%0Afrom%20azureml.datadrift%20import%20DataDriftDetector%0Afrom%20datetime%20import%20datetime%0A%0A%23%20get%20the%20workspace%20object%0Aws%20%3D%20Workspace.from_config()%0A%0A%23%20get%20the%20target%20dataset%0Adset%20%3D%20Dataset.get_by_name(ws%2C%20'target')%0A%0A%23%20set%20the%20baseline%20dataset%0Abaseline%20%3D%20target.time_before(datetime(2019%2C%202%2C%201))%0A%0A%23%20set%20up%20feature%20list%0Afeatures%20%3D%20%5B'latitude'%2C%20'longitude'%2C%20'elevation'%2C%20'windAngle'%2C%20'windSpeed'%2C%20'temperature'%2C%20'snowDepth'%2C%20'stationName'%2C%20'countryOrRegion'%5D%0A%0A%23%20set%20up%20data%20drift%20detector%0Amonitor%20%3D%20DataDriftDetector.create_from_datasets(ws%2C%20'drift-monitor'%2C%20baseline%2C%20target%2C%20%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20compute_target%3D'cpu-cluster'%2C%20%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20frequency%3D'Week'%2C%20%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20feature_list%3DNone%2C%20%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20drift_threshold%3D.6%2C%20%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20latency%3D24)%0A%0A%23%20get%20data%20drift%20detector%20by%20name%0Amonitor%20%3D%20DataDriftDetector.get_by_name(ws%2C%20'drift-monitor')%0A%0A%23%20update%20data%20drift%20detector%0Amonitor%20%3D%20monitor.update(feature_list%3Dfeatures)%0A%0A%23%20run%20a%20backfill%20for%20January%20through%20May%0Abackfill1%20%3D%20monitor.backfill(datetime(2019%2C%201%2C%201)%2C%20datetime(2019%2C%205%2C%201))%0A%0A%23%20run%20a%20backfill%20for%20May%20through%20today%0Abackfill1%20%3D%20monitor.backfill(datetime(2019%2C%205%2C%201)%2C%20datetime.today())%0A%0A%23%20disable%20the%20pipeline%20schedule%20for%20the%20data%20drift%20detector%0Amonitor%20%3D%20monitor.disable_schedule()%0A%0A%23%20enable%20the%20pipeline%20schedule%20for%20the%20data%20drift%20detector%0Amonitor%20%3D%20monitor.enable_schedule()%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EOf%20course%2C%20you%20can%20do%20this%20all%20through%20the%20Azure%20ML%20Studio%20(ml.azure.com)%20if%20you%20run%20the%20Enterprise%20features.%26nbsp%3B%20Oops%2C%20there%20are%20locks%20beside%20them!%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22AzureML.PNG%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F175976iF66E7BE894A56FCF%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%22AzureML.PNG%22%20alt%3D%22AzureML.PNG%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3ENot%20to%20worry%2C%26nbsp%3B%3CSPAN%20style%3D%22display%3A%20inline%20!important%3B%20float%3A%20none%3B%20background-color%3A%20%23ffffff%3B%20color%3A%20%23333333%3B%20cursor%3A%20text%3B%20font-family%3A%20inherit%3B%20font-size%3A%2016px%3B%20font-style%3A%20normal%3B%20font-variant%3A%20normal%3B%20font-weight%3A%20300%3B%20letter-spacing%3A%20normal%3B%20line-height%3A%201.7142%3B%20orphans%3A%202%3B%20text-align%3A%20left%3B%20text-decoration%3A%20none%3B%20text-indent%3A%200px%3B%20text-transform%3A%20none%3B%20-webkit-text-stroke-width%3A%200px%3B%20white-space%3A%20normal%3B%20word-spacing%3A%200px%3B%22%3E%20if%20you%20see%20a%20lock%20beside%20the%20features.%20just%20click%20on%20Automated%20ML%20or%20Designer%20in%20the%20left-hand%20navigation%20pane%20and%20you'll%20see%20an%20upgrade%20modal%20appear%20and%20it%20literally%20takes%20just%20a%20few%20seconds%20to%20do.%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20style%3D%22display%3A%20inline%20!important%3B%20float%3A%20none%3B%20background-color%3A%20%23ffffff%3B%20color%3A%20%23333333%3B%20cursor%3A%20text%3B%20font-family%3A%20inherit%3B%20font-size%3A%2016px%3B%20font-style%3A%20normal%3B%20font-variant%3A%20normal%3B%20font-weight%3A%20300%3B%20letter-spacing%3A%20normal%3B%20line-height%3A%201.7142%3B%20orphans%3A%202%3B%20text-align%3A%20left%3B%20text-decoration%3A%20none%3B%20text-indent%3A%200px%3B%20text-transform%3A%20none%3B%20-webkit-text-stroke-width%3A%200px%3B%20white-space%3A%20normal%3B%20word-spacing%3A%200px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-left%22%20image-alt%3D%22Upgrade.PNG%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F175978i4D333577EFCAF135%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20title%3D%22Upgrade.PNG%22%20alt%3D%22Upgrade.PNG%22%20%2F%3E%3C%2FSPAN%3EOnce%20you're%20finished%20with%20the%20upgrade%20to%20Enterprise%20features%20you'll%20be%20able%20to%20configure%20your%20data-drift%20monitor%20within%20the%20portal.%20%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20style%3D%22display%3A%20inline%20!important%3B%20float%3A%20none%3B%20background-color%3A%20%23ffffff%3B%20color%3A%20%23333333%3B%20cursor%3A%20text%3B%20font-family%3A%20inherit%3B%20font-size%3A%2016px%3B%20font-style%3A%20normal%3B%20font-variant%3A%20normal%3B%20font-weight%3A%20300%3B%20letter-spacing%3A%20normal%3B%20line-height%3A%201.7142%3B%20orphans%3A%202%3B%20text-align%3A%20left%3B%20text-decoration%3A%20none%3B%20text-indent%3A%200px%3B%20text-transform%3A%20none%3B%20-webkit-text-stroke-width%3A%200px%3B%20white-space%3A%20normal%3B%20word-spacing%3A%200px%3B%22%3EIn%20the%20next%20article%20we'll%20setup%20a%20new%20dataset%20and%20also%20ensure%20that%20we%20are%20collecting%20and%20monitoring%20for%20data%20drift.%20%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-TEASER%20id%3D%22lingo-teaser-1201319%22%20slang%3D%22en-US%22%3E%3CP%3EIn%20this%20article%20we'll%20discuss%20what%20Data%20Drift%20is%20and%20how%20to%20get%20started%20with%20monitoring%20data%20drift%20within%20the%20Azure%20ML%20SDK%20and%20how%20to%20enable%20the%20feature%20within%20the%20Azure%20ML%20Studio%20portal.%3C%2FP%3E%3C%2FLINGO-TEASER%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1201319%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EData%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EData%20Architecture%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EData%20Science%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EProcess%20and%20Procedure%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Microsoft

In this new age of collaboration including a more refined focus on Data Engineering, Data Science Engineering, and AI Engineering it becomes necessary to be clear that the choppy “swim-lanes” of responsibility have become even more blurred.

In this short post, I wanted to cover a new feature in the Azure Machine Learning Studio named, Data Drift Detection.  Data Drift for this article is the change in model input data that leads to model performance degradation. It is one of the top reasons where model accuracy degrades over time, thus monitoring data drift helps detect model performance issues.  

 

Some major causes of data drift may include: 

Causes of data drift include:

  • Upstream process changes, such as a sensor being replaced that change the unit of measure being applied.  Maybe from Imperial to Metric?
  • Data quality issues, such as a failed deployment of a patch for a software component or a failed sensor reading 0.
  • Natural drift in the data, such as mean temperature changing with the seasons or deprecated interface features no longer being utilized.
  • Change in relation between features, or covariate shift.

With the use of Dataset monitors in Azure Machine Learning studio, your organization is able to setup alerts to assist in the detection of data drift which can be useful in helping you maintain a healthy and accurate Machine Learning Model in your deployments.  

 

There are 3 primary scenarios for setting up dataset monitors in Azure Machine Learning

 

Scenario Description
Monitoring a model's serving data for drift from the model's training data Results from this scenario can be interpreted as monitoring a proxy for the model's accuracy, given that model accuracy degrades if the serving data drifts from the training data.
Monitoring a time series dataset for drift from a previous time period. This scenario is more general, and can be used to monitor datasets involved upstream or downstream of model building. The target dataset must have a timestamp column, while the baseline dataset can be any tabular dataset that has features in common with the target dataset.
Performing analysis on past data. This scenario can be used to understand historical data and inform decisions in settings for dataset monitors.

 

Your dataset will require a timestamp; however, once you have a baseline dataset defined - your target dataset or incoming model input will be compared on the intervals specified to help your system become more proactive. 

 

Using the azureml SDK you would execute the following code to create a workspace (your Azure Machine Learning workspace), your originating Datastore, and the Dataset you wish to monitor.

 

 

 

from azureml.core import Workspace, Dataset, Datastore

# get workspace object
ws = Workspace.from_config()

# get datastore object 
dstore = Datastore.get(ws, 'your datastore name')

# specify datastore paths
dstore_paths = [(dstore, 'weather/*/*/*/*/data.parquet')]

# specify partition format
partition_format = 'weather/{state}/{date:yyyy/MM/dd}/data.parquet'

# create the Tabular dataset with 'state' and 'date' as virtual columns 
dset = Dataset.Tabular.from_parquet_files(path=dstore_paths, partition_format=partition_format)

# assign the timestamp attribute to a real or virtual column in the dataset
dset = dset.with_timestamp_columns('date')

# register the dataset as the target dataset
dset = dset.register(ws, 'target')

 

 

Once this is established you can build a dataset monitor to detect drift with the delta range you provide

 

 

from azureml.core import Workspace, Dataset
from azureml.datadrift import DataDriftDetector
from datetime import datetime

# get the workspace object
ws = Workspace.from_config()

# get the target dataset
dset = Dataset.get_by_name(ws, 'target')

# set the baseline dataset
baseline = target.time_before(datetime(2019, 2, 1))

# set up feature list
features = ['latitude', 'longitude', 'elevation', 'windAngle', 'windSpeed', 'temperature', 'snowDepth', 'stationName', 'countryOrRegion']

# set up data drift detector
monitor = DataDriftDetector.create_from_datasets(ws, 'drift-monitor', baseline, target, 
                                                      compute_target='cpu-cluster', 
                                                      frequency='Week', 
                                                      feature_list=None, 
                                                      drift_threshold=.6, 
                                                      latency=24)

# get data drift detector by name
monitor = DataDriftDetector.get_by_name(ws, 'drift-monitor')

# update data drift detector
monitor = monitor.update(feature_list=features)

# run a backfill for January through May
backfill1 = monitor.backfill(datetime(2019, 1, 1), datetime(2019, 5, 1))

# run a backfill for May through today
backfill1 = monitor.backfill(datetime(2019, 5, 1), datetime.today())

# disable the pipeline schedule for the data drift detector
monitor = monitor.disable_schedule()

# enable the pipeline schedule for the data drift detector
monitor = monitor.enable_schedule()

 

 

 

Of course, you can do this all through the Azure ML Studio (ml.azure.com) if you run the Enterprise features.  Oops, there are locks beside them!

 

AzureML.PNG

Not to worry,  if you see a lock beside the features. just click on Automated ML or Designer in the left-hand navigation pane and you'll see an upgrade modal appear and it literally takes just a few seconds to do.

Upgrade.PNGOnce you're finished with the upgrade to Enterprise features you'll be able to configure your data-drift monitor within the portal.  

 

In the next article we'll setup a new dataset and also ensure that we are collecting and monitoring for data drift.