SAS Viya

6月 302022
 

Welcome to the seventh installment in my series Getting Started with Python Integration to SAS Viya. In previous posts, I discussed how to connect to the CAS serverhow to execute CAS actions, and how to work with the results. Now it's time to learn how to filter CAS tables.

Load and explore data

First, I'll load the cars.csv file into memory from the sassfotware GitHub page. I'll start by using my CAS connection object conn, followed by the upload_file method from the SWAT package. The upload_file method loads a client-side file into memory on the CAS server and returns a reference to the CAS table. The data in this example is small, for training purposes. Processing data in the CAS server is typically reserved for larger data.

tbl = conn.upload_file('https://raw.githubusercontent.com/sassoftware/sas-viya-programming/master/data/cars.csv',
      casout={'name':'cars', 'caslib':'casuser'})

The response from the command is minimal, but there's much going on. Specifically:

  • Cloud Analytic Services renders the uploaded file available as table CARS in caslib CASUSER(Peter).
  • The table CARS is created in caslib CASUSER(Peter) from binary data uploaded to Cloud Analytic Services.

Next, I'll view the type and value of the tbl variable to confirm it's a CASTable object that references the CARS table in the CAS server.

display(type(tbl), tbl)
# and the command results:
swat.cas.table.CASTable
CASTable('CARS', caslib='CASUSER(Peter)')

The results show tbl is a CASTable object and references the CARS table in the CAS server. Now, when I execute methods on the tbl object, the processing occurs in CAS.

Further, let's preview the CAS table using the SWAT package head method on the tbl object.

tbl.head()

The CAS server returns 5 rows from the CAS table to the Python client as a DataFrame as expected.

Finally, I'll execute the SWAT shape attribute to view the number of rows and columns in the CAS table.

tbl.shape
# and the results
(428, 15)

Notice, the CARS CAS table contains 428 rows and 15 columns.

Filter a CAS Table

Now that we have created the table in the caslib and are familiar with the data, let's learn how to filter CAS tables!

Python Technique

First, I'll start with the traditional Pandas filtering technique. Since the SWAT package tries to blend the world of Pandas and SAS, this is a good starting point. This will filter the CAS table for rows where the Make of the car is Acura or Toyota,

makeFilter = (tbl['Make']=='Acura') | (tbl['Make']=='Toyota')
tbl[makeFilter].shape
# and the results
(35, 15)

The results show that 35 rows in the CARS CAS table have the Make Toyota or Acura.

Query Method

You can also filter a CAS table using the query method in the SWAT package. Wait a minute, does this look familiar? I mentioned SWAT blends the world of Pandas as SAS. I'll again filter for a Make of Toyota or Acura .

tbl.query("Make = 'Acura' or Make = 'Toyota'").shape
# and the results
(35, 15)

Notice, the results are the same.

isin Method

All right. Sorry, but again I'll show you another familiar method from the SWAT package. Since I am filtering for specific categories, I can also use the SWAT isin method, which works similarly to the Pandas isin method!

tbl[tbl.Make.isin(['Acura', 'Toyota'])].shape
# and the results
(35, 15)

Notice, again the results are the same.

CAS Table WHERE Parameter

Lastly, I'll show you a specific CAS technique, which is very efficient if you need to filter data for multiple methods or actions. To begin, let's display the type and value of the tbl object again.

display(type(tbl), tbl)
# and the results
swat.cas.table.CASTable
CASTable('CARS', caslib='CASUSER(Peter)')

Notice the tbl variable is a CASTable object, which is a reference to a CAS table in the CAS server, not an actual table. In this example, it references the CARS table in the Casuser caslib.

The CASTable object enables you to add a variety of parameters to the object to filter, create columns, group and more. In this example, I'll add the where parameter to the CASTable object to filter for car makes of Toyota and Acura. Then I'll display the value of the CASTable object again.

tbl.where = 'Make = "Acura" or Make = "Toyota"'
display(tbl)

CASTable('CARS', caslib='CASUSER(Peter)', where='Make = "Acura" or Make = "Toyota"')

Notice the CASTable still references the CARS table in the Casuser caslib, but the where parameter has been added to the object. The where parameter is applied when the object is used with an action or method.

Let's check it out. Here I'll specify the tbl variable (the CASTable object) then the shape attribute.

tbl.shape
# and the results
(35, 15)

Notice the results again show 35 cars are either Toyota or Acura.

Now, what is nice about using this method is if I want to continue to use this filter with other methods or actions, all I need to do is use the tbl object. Perhaps you want the value counts of each Make? The SWAT package has the value_counts method available.

tbl.Make.value_counts()
# and the results
Toyota    28
Acura      7

The response displays the counts only for rows where Make is Acura or Toyota. This occurs because the where parameter is applied to the CAS table when the value_counts method is executed.

Delete the WHERE parameter

Lastly, if you want to delete the where parameter from the CASTable object, use the del_params method.

tbl.del_params('where')
display(tbl)
# and the results
CASTable('CARS', caslib='CASUSER(Peter)')

Once the parameter is deleted you can revert back to analyzing the entire table. Here I'll use the shape attribute again to view how many rows are in the original CAS table.

tbl.shape
# and the results
(428, 15)

Summary

SAS Viya offers various filtering options for CAS tables. The SWAT package blends the world of Pandas and SAS, making available many familiar Pandas techniques. You also have specific CAS techniques handy when working with the CASTable object directly. Choosing the correct method may depend on your greater code structure, but you now have the right tools to make that decision.

Additional and related resources

Getting Started with Python Integration to SAS® Viya® - Part 7 - Filtering CAS Tables was published on SAS Users.

6月 152022
 

Have you ever heard the phrase “beggars can’t be choosers”? Basically, it means that if you ask for something, be grateful for what you get, especially if you don’t have the means to acquire it yourself. This phrase can be widely applicable to most areas of our lives, but when it comes to preparing data in SAS Viya, beggars can be choosers.

SAS Viya has many tools for preparing your data: you can write code in SAS Studio, create plans in SAS Data Studio, or prepare data within reports in SAS Visual Analytics. Because each of these tools has its own features and functions, you may find yourself wondering, which tool should I use?

The answer, like the answer to many questions, is it depends. What are you trying to do? What skills do you have? How quickly does the data need to be ready to use? How many people will be using the data and how?

The tool you choose will boil down to two factors: (1) simplicity and (2) control. For example, let’s say you need to create a calculated column quickly. The easiest way to create this column is within SAS Visual Analytics. You can create the new column without having to switch tools. SAS Visual Analytics is great for preparing data with little effort (no code needed) and limited control (limited options available).

On the other hand, let’s say you need to perform a more complex action like transposing or appending data sets, or standardizing values. SAS Visual Analytics, while easy to use, doesn’t have the features available for this level of data preparation. Instead, you can create a plan in SAS Data Studio to prepare your data. SAS Data Studio is great for preparing data with moderate effort (little to no code needed) and moderate control (more options available).

If you want to have full control, you can write code in SAS Studio to prepare your data. SAS Studio is great for preparing your data with more effort (may require some coding) and full control (unlimited options).

So, you can really think about it as a tradeoff between simplicity and control.  To perform more complex data preparation tasks, you need more control.

I like to think about it in the context of drawing. Let’s say I want to draw an elephant. Before I start to draw, I need to think about how much time I have available (simplicity) and the level of detail I want to include in my drawing (control).

If I’m playing Pictionary, a charades-inspired word-guessing game where you draw a picture so your teammate can identify a specific word, I want to draw the simplest picture possible so my teammate can guess the word as quickly as possible. I don’t need to create the best-looking picture in the world; I just need my teammate to guess correctly in the shortest amount of time. SAS Visual Analytics is the Pictionary version of my elephant.

On the other hand, if I want to sketch a cute picture of an elephant for my niece’s birthday card, I may want to spend a bit more time on the drawing and add some additional details like eyes and a mouth. SAS Data Studio is the birthday card sketch version of my elephant.

If I’m interested in creating a real-life approximation of an elephant, however, I may want to spend a lot more time and add a lot more detail like shading. SAS Studio is the real-life drawing version of my elephant.

Note: The SAS Visual Analytics version took me about 5 seconds to draw, the SAS Data Studio version took me about 5 minutes, and the SAS Studio version took me an hour.

Now you’re probably wondering, when do I use each tool?

SAS Visual Analytics

Use SAS Visual Analytics in the following scenarios:

  • Modifying properties: modify properties of data items (names, formats, classifications, aggregations).
  • Filters: create subsets of the data for the report (data source filters) or specific objects (basic filters, advanced filters, post-aggregate filters, common filters). Note: Post-aggregate filters, basic filters, and common filters can only be created in SAS Visual Analytics.
  • Calculated items: create a simple calculation, like number of days to delivery (calculated item) or percent of total (aggregated measure) or custom groupings (custom categories). Note: Due to their dynamic nature, aggregated measures can only be created in SAS Visual Analytics.
  • Hierarchies and geography data. Note: Hierarchies and geography data items can only be created in SAS Visual Analytics.
  • A simple join between two tables based on equality condition (for example, T1.Date = T2.OrderDate).
  • Mapping data sources: select a value in an object that uses Table A and filter the associated values in an object that uses Table B (mapping) and the common column between Table A and Table B is used by both objects. Note: Mapping data sources can only be performed in SAS Visual Analytics.
  • Aggregated data sources: create an aggregated version of the table.
  • Data views for ad-hoc analysis: changes made to data in SAS Visual Analytics are available only for the specific report. To apply data changes to other reports that use the same data source, you can create and share a data view, but you cannot use that prepared data outside of SAS Visual Analytics.

SAS Data Studio

Use SAS Data Studio in the following scenarios:

  • Improve data quality with casing, parsing, extraction, identification analysis, generating matchcodes, standardizing, or matching and clustering.
  • To discover and address unknown problems in your data using the Suggestions.
  • Append tables or transpose.
  • Create a join between two or more tables (maximum is 32) based on equality condition (for example, T1.Date = T2.OrderDate) or when the common column between the data sources is calculated (for example, datepart(T1.Date) = T2.OrderDate).
  • Write custom DATA step or CASL code to perform any required data preparation action.
  • To create tables used for many reports, by many analysts, and in different Viya tools. Note: Jobs can be created from plans and scheduled to run at specific times to ensure the data is up-to-date.

Note: You can also modify the properties of data items, create subsets of the data, and create calculated items in SAS Data Studio.

SAS Studio

Use SAS Studio in the following scenarios:

  • Programming with SAS Data Quality: improve data quality programmatically with casing, parsing, extraction, identification analysis, generating matchcodes, standardizing, or matching and clustering.
  • Create a non-equi join (for example T1.Date > T2.EndDate) between two or more tables or when the common column between the data sources is calculated (for example, datepart(T1.Date) = T2.OrderDate).

Note: You can use the SQL procedure or CASL code to perform the join.

Note: The DATA step can be used to combine tables where the name of the column is the same in each table.

  • Programming with the DATA step: perform complex conditional logic, use arrays, or process data iteratively using the DATA step.
  • Programming with SQL: perform any action that requires the use of SQL code (creating subqueries, using set operators, inserting rows into tables, updating values in a table, using DICTIONARY tables, and more).
  • Using SAS procedures: use any SAS procedure not associated with a transform in SAS Data Studio (for example, FORMAT, REPORT, FREQ, UNIVARIATE, and more).
  • Programming with macros: generate dynamic code based on data or user input using the SAS macro language.
  • Create tables used for many reports, by many analysts, and in different Viya tools.

Note: Jobs can be created from SAS code and scheduled to run at specific times to ensure the data is up-to-date.

Note: You can also modify properties of data items, create subsets of the data, create calculated items, create custom groupings, create aggregated tables, append and transpose data, and write custom DATA step or CASL code in SAS Studio.

Summary

The following table summarizes the data preparation actions you can perform in each tool.

Action SAS Visual Analytics SAS Data Studio SAS Studio
Modify properties of data items (names, formats, classifications, aggregations)
 
Filter the data
Filter specific objects in a report
 
Create simple calculations
Create custom groupings
Create dynamic aggregated measures
Create hierarchies
Create geography data items
 
Map data sets to apply interactions between two objects that use different data sources
Perform simple joins between two tables based on equality condition
Perform joins between more than two tables (up to 32) based on equality condition
Perform joins when the common column needs to be calculated
Perform non-equi joins
 
Create an aggregated table
Append tables
Transpose tables
 
Improve data quality with transforms
Improve data quality programmatically
Determine data issues using Suggestions
 
Write DATA step code
Write CASL code
Write SQL code
Use SAS procedures
Use SAS macro language
 
Perform ad-hoc analysis
Create tables used for many reports
Schedule actions to run on a repeatable basis

 

For more information about how to use SAS Visual Analytics to prepare your data and create advanced reports, check out my book Interactive Reports in SAS Visual Analytics: Advanced Features and Customization.

Beggars can’t be choosers…Unless they’re using SAS Viya was published on SAS Users.

6月 062022
 

This article was co-authored by Deva Kumar and Ali Dixon.

The launch of SAS Analytics Pro Advanced Programming offers key statistical capabilities in a docker container. The product bundles selected executables from SAS Viya to create the container, which eases or streamlines the setup required for fixes and updates to the software.

Current and new users can use the platform for data management, advanced analytics, reporting and batch processing. It includes the products in SAS Analytics Pro, Base SAS, SAS Studio 5.2, SAS/STAT, SAS/GRAPH. Integration with Python is available and includes Proc Python and access to saspy from python clients (ex: JupyterLab). Analytics Pro Advanced Programming offers the addition of SAS/ETS, SAS/IML, SAS/OR and SAS/QC.

For the remainder of this post, a reference to “Analytics Pro” includes the features of both Analytics Pro and Analytics Pro Advanced Programming on Viya.

Easy as 1-2-3 OR Simple is Good

Analytics Pro is delivered as a Docker image. This makes it easy to deploy, use and maintain. The diagram below shows that it takes just 3 steps to begin programming with SAS on your workstation.

Getting Started With APro

For a current Analytics Pro 9.x user, Analytics Pro is the next generation with all the goodness of Analytics Pro 9.x with many improvements from SAS Viya.

What is the same?

Users can run all of their existing programs with Analytics Pro. A few things like having a filename to a C: drive must change, but not the logic of the program. Users can run interactively using SAS Studio or run batch jobs.

Users can continue to program using the SAS Language consisting of DataStep, Procedures and Macros.

What is different?

Analytics Pro is “carved” out of SAS Viya so that it is familiar to current SAS 9.x users. In keeping with this philosophy, Analytics Pro does not include many of the advanced capabilities of SAS Viya.

  • The Cloud Analytic Server (CAS) is not included. However, Analytics Pro programs can connect to CAS.
  • To keep the size small, Analytics Pro does not include the latest version of SAS Studio or any of the other great visual products on SAS Viya.
  • Analytics Pro includes the database engines that are on SAS Viya. There are no additional charges for these.
  • Analytics Pro includes Proc Python from SAS Viya allowing users to include Python code as part of the SAS program.
  • Python programmers can use SASPy to access Analytics Pro from their Python code.
  • Updates are shipped monthly giving users the latest fixes and updates. This will include any new database drivers that are added to SAS Viya and other SAS Viya features like Proc Python.

What if users want to run it on the cloud?

One of the advantages of Analytics Pro is it will fit into the user’s cloud strategy. The container can be in docker on virtual machines – Linux or Windows. See this article for an example. The container can also be deployed on Kubernetes clusters. Users can use the platform that suits their needs.

View a demo of these new features and learn more on the SAS Viya Release Highlights Show.



SAS Analytics Pro Advanced Programming provides a powerful package to explore and solve problems for those seeking new statistical capabilities.

Learn more

Check out these Analytics Pro articles or take a deep dive into this additional Analytics Pro documentation.

Introducing Analytics Pro Advanced Programming: The power of SAS on your desktop was published on SAS Users.

5月 202022
 

In the previous article, we demonstrated how to run CMS-HCC Risk Adjustment Models using SAS Analytics Pro on Viya. Recall that we used the SAS Studio interface to access the demographic and diagnoses input data, set up the model score code and score the input data.

In this third article, we will introduce an alternative approach that surfaces the CMS-HCC Risk Adjustment Model execution through SASPy integration to a Flask application. We will demonstrate how this integration allows a user to score an individual patient/member on-demand, using inputs to an interactive web form to execute the model score code, surfacing the resulting score to the user.

You may be thinking, "Why would I want to do this? Isn’t it sufficient to run the CMS-HCC Risk Adjustment Models manually as necessary?" Of course, there is nothing wrong with running the models via SAS Studio as needed and relying on a person to do so.

However, there are scenarios where an automated approach, less dependent on the active participation of a person and integrated with a third-party application is preferred. For example, you may need your CMS-HCC Risk Adjustment Model to run on-demand based on a 3rd party application that was developed by your clients or you may need to run the models as part of a process that is detached from your SAS deployment.

In these cases, you can take advantage of SAS, SASPy integration and cloud infrastructure to achieve the level of automation and integration required. Rather than the MacBook deployment leveraged in the prior article, we will use a deployment of SAS Analytics Pro Viya on a Linux server instance in Azure.

The following lists the step-by-step process to run the CMS-HCC Risk Adjustment Model through SASPy API integration to a Flask application.

  1. The Flask application receives the input form data from the web browser as JSON
  2. Python uses SASPy to connect to SAS Analytics Pro Viya via SSH
  3. SASPy parses the JSON input into SAS tables
  4. SASPy submits SAS code with the SAS tables as input to SAS Analytics Pro on Viya
  5. SAS Analytics Pro Viya runs the code and generates an output SAS table in the output folder
  6. SASPy accesses the output SAS table and converts it to a Pandas data frame
  7. Flask exposes the data frame as JSON back to the web browser

To achieve this integrated process, we are going to walk through all the necessary deployment and configuration steps in a video. To follow along, the following items are required:

  • Azure subscription
  • Azure Linux instance deployed
  • License for SAS Analytics Pro Viya – save it under the sasinside folder
  • Knowledge of Linux to execute scripts
  • Familiarity with Docker containers
  • Clone the provided GitHub repository

Watch the video below to see a detailed demonstration of the deployment and configuration steps.

The video follows the whole process with the high-level steps outlined here.

  1. Deploy an Azure instance with Ubuntu
  2. Install Docker on this instance
  3. Clone the GitHub repository
  4. Install SAS Analytics Pro on Viya container
  5. Configure password-less SSH
  6. Build the Flask application container
  7. Run the Flask application container
  8. Test password-less SSH from the Flask application container to the SAS Analytics Pro on Viya container
  9. Configure ports on the Azure instance to confirm it is accessible from my machine
  10. Run the application on the browser to score a patient/member with the CMS-HCC model

This is the overall architecture of the application found on this GitHub repository.

If you followed along with the deployment and configuration, you may have additional questions. If you are wondering about the purpose of the sascfg_personal.py file, it tells SASPy how to connect via SSH to the SAS Analytics Pro on Viya container. You have to specify the host, localhost and luser options to make sure SASPy can successfully connect.

If you run the SAS Analytics Pro on Viya container first, Docker will probably assign 172.17.0.2 as the IP for that container and 172.17.0.3 for the Flask container. If you suspect the IP is different, inspect the container to make sure the IP is correct.

 
SAS_config_names   = ['ssh']
ssh                = {'saspath'  : '/opt/sas/viya/home/SASFoundation/sas',
                      'ssh'      : '/usr/bin/ssh',
                      'host'     : '172.17.0.2', # sas apro container host
                      'luser'    : 'sasdemo',
                      'localhost': '172.17.0.3', # local Python container ip address
                      'options'  : ["-fullstimer"]
                     }

For more information, check out the official documentation page.

Thanks to everyone that contributed to this blog series and to those that followed it from the beginning. I hope this was helpful and that you learned something along the way.

*If you are interested in a license for SAS Analytics Pro on Viya, contact your SAS representative or get in contact with SAS through the chatbot on sas.com.

Running CMS Risk Adjustment Models via API with SAS Analytics Pro (Viya) on Azure was published on SAS Users.

5月 162022
 

Just getting started with this series? Make sure to explore the earlier posts Part 1, Part 2 and Part 3.

Up until now, you have seen how ModelOps can solve your biggest machine learning challenges and that SAS and Microsoft, together, can help you deploy, govern and monitor your models anywhere in the Microsoft Cloud. But what does that look like in practice and what value does that provide you?

In this blog, we will share how to register SAS and open-source models from SAS Model Manager to Azure Machine Learning and then call that model directly from Power BI.

SAS Model Manager is a centralized, searchable repository for all types of models and analytical assets. This solution gives you complete visibility into your analytical processes, ensuring traceability and governance. SAS Viya on Azure allows you to efficiently move your analytical models from the innovation lab into production. With SAS and Microsoft, you can now easily and seamlessly deploy models in Azure Machine Learning (AML).

Step 1: SAS Model Manager governs, deploys, and monitors all types of SAS and open-source models (i.e., Python, R). Deploy your model registered in SAS Model Manager to Azure Machine Learning.

Once a model is deployed into Azure Machine Learning it can be leveraged just like any other model in Azure Machine Learning while maintaining the governance and control that Viya offers.

Step 2: Refresh Azure Machine Learning to find your model with associated artifacts and variable metrics that can be used to publish the model in an executable container runtime supporting SAS and open-source models.

After you publish a model to an Azure Machine Learning publishing destination you can deploy the published model to AKS. This enables you to make the published model available so that you score it using custom code or another application outside the SAS Viya environment. It also enables you to deploy the published model in a production environment.

Step 3: Go back to SAS Model Manager to deploy the model to AKS (Azure Kubernetes Services) which is the Azure Machine Learning compute target. This steps ensures that the model you have published is ready to be deployed.

Step 4: Score your model in Azure Machine Learning.

Step 5: Score your model from Power BI.

When a new model is developed and ready for production, it is easy to register that model in Azure Machine Learning and replace the existing model that is in production. This allows business intelligence users to quickly gain access to the most accurate insights. By leveraging the strengths of the ModelOps lifecycle that SAS has developed the deployment mechanism and distribution of that model using the Microsoft Cloud, models can be pushed out into production in an automated and repeatable way. The combination of SAS Viya and Azure Machine Learning accelerates the time to value for customers who are looking to incorporate DevOps principles into their model development and deployment.

To learn more about ModelOps and our partnership with Microsoft, see our whitepaper: ModelOps with SAS Viya on Azure.

ModelOps in practice: How to call SAS models from Microsoft Power BI, part 4 was published on SAS Users.

5月 132022
 

As more businesses embrace their digital transformation journeys, it’s easy to get lost in the cloud hype and overinflate the possibilities of cloud alone. Cloud migration is not a one-stop shop to solve all of an organization’s challenges. Instead, technology leaders need to adopt a cloud-smart mindset to maximize value, [...]

The transformative impact of SAS Viya on Azure was published on SAS Voices by Jay Upchurch

5月 102022
 

A cancer journey affects both physical and mental health. This often results in feelings of social isolation, loss of identity, clinical depression and even PTSD. This often goes unrecognized and undiagnosed due in part to lack of resources, tools and time. Swedish startup War On Cancer wondered whether they could [...]

The social impact of data science: improving the mental health for cancer patients with AI was published on SAS Voices by Marinela Profi

5月 052022
 

The SAS Viya LTS 2021.2 release supports application multi-tenancy. This 3-part series reviews how authentication can be configured.

SAS Viya 2021.2 OIDC with Multi-Tenancy

In this post, we look at configuring OpenID Connect (OIDC) authentication in a multi-tenant (M-T) environment. The SAS Viya configuration of OIDC authentication could be performed in the M-T provider and apply to all tenants or could be configured in one or more individual tenants and only apply to that tenant. For this post, we configure ODIC for the M-T provider and the marketing tenant.

The third-party OIDC Identity Provider, such as Azure Active Directory, has three key properties. These are:

  1. The Relying Party ID or Client ID – which is a unique name for the SAS Viya instance in the third-party OIDC Identity Provider.
  2. The Relying Party Secret or Client Secret – which is a shared secret between the SAS Viya instance and the third-party OIDC Identity Provider used to authenticate SAS Viya to the OIDC Identity Provider.
  3. One or more Redirect URIs – these are normally fully qualified URLs registered with the third-party OIDC Identity Provider. Only authentication requests coming from these registered URLs are valid.

SAS Viya 2021.2 SAML with Multi-Tenancy

In this post, we look at configuring SAML authentication in a multi-tenant (M-T) environment. There are two parts to the SAS Viya SAML configuration. The first part configures SAS Logon Manager as a SAML Service Provider and is configured with the settings under sas.logon.saml. The SAML Service Provider settings are configured only in the M-T provider.

The second part of the SAS Viya SAML configuration is the link to the third-party SAML Identity Provider, and is configured with the settings under sas.logon.saml.providers. The sas.logon.saml.providers settings can be configured for the M-T provider and apply to the provider and all tenants. Or the sas.logon.saml.providers settings can be configured for an individual tenant and apply to that tenant only.

For this post, we configure the sas.logon.saml settings in the M-T provider. Then we configure the sas.logon.saml.providers settings in both the M-T provider and the marketing tenant.

SAS Viya 2021.2.4 Bypass SAS Logon Manager

Prior to the SAS Viya 2021.2.4 release, SAS provided a sample patch transformer to update the SAS Logon Manager Ingress definition. This patch transformer used a server snippet annotation to insert a login_hint into requests. Adding the login_hint allowed customers using SAML or OpenID Connect to bypass SAS Logon Manager, meaning that end-users would automatically get redirected to the third-party SAML or OIDC Identity Provider (IdP). However, an issue with custom snippets was discovered, as documented in CVE-2021-25742. With SAS Viya 2021.2.4 the sample patch transformer has been removed and SAS is providing a configuration option to enable bypassing SAS Logon Manager. In this post, we discuss this updated approach for bypassing SAS Logon Manager.

Configuring authentication for SAS Viya multi-tenancy: A 3-part series was published on SAS Users.

5月 032022
 

Just getting started with this series? Make sure to explore Part 1 and Part 2.

There are different ways you can use these two tools to accelerate model building, deployment and monitoring. Figure 1 summarizes best practices for conducting ModelOps using SAS Model Manager and Azure Machine Learning.

Figure 1: Five best practices to optimize the ModelOps life cycle on the Microsoft Cloud.

Best practice 1: Create models with repeatable machine learning pipelines using SAS® Model Manager

When data scientists create models in SAS Viya and register in SAS Model Manager, they can innovate and build faster. SAS Viya not only creates pipelines of reusable machine learning components but also allows users to easily import reusable components from any language. SAS Viya can also convert score code from one language to another, helping developers avoid recoding efforts. For example, SAS Viya can import R or Python packages, or even a Jupyter notebook, and instantly convert them to run in SAS code (and vice versa).

Central to these SAS capabilities is the modeling metadata repository that SAS uses for drift monitoring and oversight functions. The actual code repository can be in GitHub, Microsoft’s library for prebuilt code. Integrated SAS capabilities enable you to store and keep track of repeatable components in GitHub and make it easy for others to find and reuse them. In this way, SAS supports an ecosystem for model development. SAS Model Manager also provides this central modeling metadata repository and simultaneously enhances Azure MLOps processes.

As you build models, you can test them using SAS Model Manager before putting them into production. Whether you create in Python, R, SAS or a Jupyter Notebook, the software enables you to efficiently validate the model logic using precise methodology that records each test. As a result, you always know models will run seamlessly in your deployed environment.

Best practice 2: Apply automation to your ModelOps rollout and audit trail

SAS Model Manager also facilitates more effective governance by enabling users to:

    • Collect all models, projects and pipelines in a searchable, secure and versioned repository.
    • Keep track of different versions for each model so you can track model history and ownership changes in a single, readily available user interface.
    • Compare models from different languages and libraries side by side (for instance, SAS, TensorFlow, scikit-learn and more).
    • Maintain model version control and history tracking in one place.
    • Access models and model-score artifacts using open REST APIs.

Best practice 3: Use Azure Machine Learning to deploy models into the Microsoft Cloud

Now that you have validated your model, the analytic scoring code will execute correctly, and you can deploy your model anywhere in the Microsoft Cloud. You can call your model from Microsoft Dynamics 365, Azure Synapse Analytics and Microsoft Power Platform, including Power BI, which empowers you to bring your models to more places.

You can also deploy your model to the OCI (Open Container Initiative) compliant Docker containers in the Microsoft Cloud as a lightweight image in SAS Container Runtime (SCR). SCR images provide a modern, bulletproof, reliable, nonproprietary system for transferring and executing runtime code. This greatly simplifies efforts to move code from your development system to your production system. Simply register your SAS containerized model to your favorite Microsoft Azure or docker location and create an app or use REST APIs to score new data against your published model with SAS Container Runtime.

Best practice 4: Use SAS® Model Manager to monitor performance and drift

Models begin to degrade the moment you put them in production as conditions in the market, customer behavior and data change over time. SAS Model Manager includes performance monitoring to easily track and view performance against the KPIs that have been predetermined with IT and line-of-business experts.

SAS Model Manager also supplements the ModelOps process by empowering line-of-business experts to take ownership of the monitoring process. For example, SAS Model Manager provides visual analytics and reporting from which you can centrally monitor model performance within Azure Machine Learning and detect model drift. Use it to:

    • Generate out-of-the-box performance reports using a wizard.
    • Easily access data to build your own reports and KPIs.
    • Schedule jobs to detect model drift and automatically retrain models in case of poor performance or bias detection.

Data visualizations make it easy for teammates in the line of business to see data score changes, monitor changes in accuracy over time and see which models are drifting and need retraining.

Best practice 5: Use SAS® Model Manager to retrain, score and redeploy models faster

If model performance degrades, your organization should embark on one of three approaches:

    • Retrain the existing model on new data.
    • Revise the model with new techniques (such as feature engineering or new data elements).
    • Replace the model entirely with a better model.

But regardless of your choice, the critical questions remain the same:

    • How do you know when you need to retrain the model?
    • Once the model is retrained, how do you determine when to redeploy the model?
    • Can you predict how long the model will be relevant?

SAS Model Manager helps you answer these questions and take timely action. If it observes model drift, it proactively alerts you with a built-in feedback mechanism and vastly simplifies, optimizes and accelerates model retraining and redeployment. In fact, SAS allows you to revise a model with new techniques (such as feature engineering or new data elements) or replace an entire model with a better one.

Learn more

There are many advantages to using SAS Model Manager with Azure Machine Learning. Most notably, you gain a no-code/low-code environment in which business analysts can build and deploy SAS and open-source models, continuously monitor for performance and drift, and retrain models – all within a single, intuitive SAS user interface. This frees you to establish collaborative, cross-functional teams that ensure models solve real business problems today, and continue to do so in the future. Issues get detected earlier – and retraining and redeployment happen faster – because all models are hosted, collected and tracked in one application. And the efficiencies you gain from automation and real-time monitoring, reporting, testing and more means you can scale your use of ML models in your Microsoft environment with confidence.

Next time, you’ll see how SAS Model Manager, Azure Machine Learning, and Power BI work in practice, by learning how to call a SAS model in Power BI.

To learn more about ModelOps and our partnership with Microsoft, see our whitepaper: ModelOps with SAS Viya on Azure.  

5 best practices for optimizing ModelOps with SAS® Model Manager and Azure Machine Learning, part 3 was published on SAS Users.

5月 032022
 

Just getting started with this series? Make sure to explore Part 1 and Part 2.

There are different ways you can use these two tools to accelerate model building, deployment and monitoring. Figure 1 summarizes best practices for conducting ModelOps using SAS Model Manager and Azure Machine Learning.

Figure 1: Five best practices to optimize the ModelOps life cycle on the Microsoft Cloud.

Best practice 1: Create models with repeatable machine learning pipelines using SAS® Model Manager

When data scientists create models in SAS Viya and register in SAS Model Manager, they can innovate and build faster. SAS Viya not only creates pipelines of reusable machine learning components but also allows users to easily import reusable components from any language. SAS Viya can also convert score code from one language to another, helping developers avoid recoding efforts. For example, SAS Viya can import R or Python packages, or even a Jupyter notebook, and instantly convert them to run in SAS code (and vice versa).

Central to these SAS capabilities is the modeling metadata repository that SAS uses for drift monitoring and oversight functions. The actual code repository can be in GitHub, Microsoft’s library for prebuilt code. Integrated SAS capabilities enable you to store and keep track of repeatable components in GitHub and make it easy for others to find and reuse them. In this way, SAS supports an ecosystem for model development. SAS Model Manager also provides this central modeling metadata repository and simultaneously enhances Azure MLOps processes.

As you build models, you can test them using SAS Model Manager before putting them into production. Whether you create in Python, R, SAS or a Jupyter Notebook, the software enables you to efficiently validate the model logic using precise methodology that records each test. As a result, you always know models will run seamlessly in your deployed environment.

Best practice 2: Apply automation to your ModelOps rollout and audit trail

SAS Model Manager also facilitates more effective governance by enabling users to:

    • Collect all models, projects and pipelines in a searchable, secure and versioned repository.
    • Keep track of different versions for each model so you can track model history and ownership changes in a single, readily available user interface.
    • Compare models from different languages and libraries side by side (for instance, SAS, TensorFlow, scikit-learn and more).
    • Maintain model version control and history tracking in one place.
    • Access models and model-score artifacts using open REST APIs.

Best practice 3: Use Azure Machine Learning to deploy models into the Microsoft Cloud

Now that you have validated your model, the analytic scoring code will execute correctly, and you can deploy your model anywhere in the Microsoft Cloud. You can call your model from Microsoft Dynamics 365, Azure Synapse Analytics and Microsoft Power Platform, including Power BI, which empowers you to bring your models to more places.

You can also deploy your model to the OCI (Open Container Initiative) compliant Docker containers in the Microsoft Cloud as a lightweight image in SAS Container Runtime (SCR). SCR images provide a modern, bulletproof, reliable, nonproprietary system for transferring and executing runtime code. This greatly simplifies efforts to move code from your development system to your production system. Simply register your SAS containerized model to your favorite Microsoft Azure or docker location and create an app or use REST APIs to score new data against your published model with SAS Container Runtime.

Best practice 4: Use SAS® Model Manager to monitor performance and drift

Models begin to degrade the moment you put them in production as conditions in the market, customer behavior and data change over time. SAS Model Manager includes performance monitoring to easily track and view performance against the KPIs that have been predetermined with IT and line-of-business experts.

SAS Model Manager also supplements the ModelOps process by empowering line-of-business experts to take ownership of the monitoring process. For example, SAS Model Manager provides visual analytics and reporting from which you can centrally monitor model performance within Azure Machine Learning and detect model drift. Use it to:

    • Generate out-of-the-box performance reports using a wizard.
    • Easily access data to build your own reports and KPIs.
    • Schedule jobs to detect model drift and automatically retrain models in case of poor performance or bias detection.

Data visualizations make it easy for teammates in the line of business to see data score changes, monitor changes in accuracy over time and see which models are drifting and need retraining.

Best practice 5: Use SAS® Model Manager to retrain, score and redeploy models faster

If model performance degrades, your organization should embark on one of three approaches:

    • Retrain the existing model on new data.
    • Revise the model with new techniques (such as feature engineering or new data elements).
    • Replace the model entirely with a better model.

But regardless of your choice, the critical questions remain the same:

    • How do you know when you need to retrain the model?
    • Once the model is retrained, how do you determine when to redeploy the model?
    • Can you predict how long the model will be relevant?

SAS Model Manager helps you answer these questions and take timely action. If it observes model drift, it proactively alerts you with a built-in feedback mechanism and vastly simplifies, optimizes and accelerates model retraining and redeployment. In fact, SAS allows you to revise a model with new techniques (such as feature engineering or new data elements) or replace an entire model with a better one.

Learn more

There are many advantages to using SAS Model Manager with Azure Machine Learning. Most notably, you gain a no-code/low-code environment in which business analysts can build and deploy SAS and open-source models, continuously monitor for performance and drift, and retrain models – all within a single, intuitive SAS user interface. This frees you to establish collaborative, cross-functional teams that ensure models solve real business problems today, and continue to do so in the future. Issues get detected earlier – and retraining and redeployment happen faster – because all models are hosted, collected and tracked in one application. And the efficiencies you gain from automation and real-time monitoring, reporting, testing and more means you can scale your use of ML models in your Microsoft environment with confidence.

Next time, you’ll see how SAS Model Manager, Azure Machine Learning, and Power BI work in practice, by learning how to call a SAS model in Power BI.

To learn more about ModelOps and our partnership with Microsoft, see our whitepaper: ModelOps with SAS Viya on Azure.  

5 best practices for optimizing ModelOps with SAS® Model Manager and Azure Machine Learning, part 3 was published on SAS Users.