172017
 

文档制作工具mkdocs学习

最近在写项目文档,发现mkdocs非常轻量,基于markdown,生成静态html,托管在服务器即可访问,非常方便适用。

1. 介绍

mkdocs是一款基于markdown构建项目文档的工具,并且通过静态html文件,可以部署在服务器上提供访问。

2. mkdocs安装

pip install mkdocs


$ mkdocs --version
mkdocs, version 0.16.1

3.1 用法

新建项目 mkdocs new 项目名称,生成一个配置文件mkdocs.yml,同时在docs文件夹下生成一个 markdown文件index.md。


$ mkdocs new deeplearning
INFO    -  Creating project directory: deeplearning
INFO    -  Writing config file: deeplearning/mkdocs.yml
INFO    -  Writing initial docs: deeplearning/docs/index.md
$ cd deeplearning/
$ ll
total 8
drwxr-xr-x  3   staff   102B  3 17 11:11 docs
-rw-r--r--  1   staff    19B  3 17 11:11 mkdocs.yml

启动mkdocs内置的develop server


 $ mkdocs serve
INFO    -  Building documentation...
INFO    -  Cleaning site directory
[I 170317 11:35:02 server:283] Serving on http://127.0.0.1:8000
[I 170317 11:35:02 handlers:60] Start watching changes
[I 170317 11:35:02 handlers:62] Start detecting changes

http://localhost:8000



3.2 文档编辑

(1)编辑页面

(2)编辑配置文件


$ cat mkdocs.yml
site_name: 深度学习
pages:
    - home: index.md
    - content: deeplearning.md
    - about: about.md




 
 Posted by at 8:36 下午
172017
 

As a SAS instructor, I’m often on the road, but, in April, my work travel path is going to take me to a place I haven’t visited since I was 12 years old. The occasion?  SAS Global Forum 2017.  The location?  Walt Disney World® in Orlando. While the main conference [...]

The post Visiting Open Attractions and Open SAS appeared first on SAS Learning Post.

172017
 

Editor’s note: This is the second in a series of articles to help current SAS programmers add SAS Viya to their analytics skillset. In this post, Advisory Solutions Architect Steven Sober explores how to accomplish distributed data management using SAS Viya. Read additional posts in the series.

This article in the SAS Viya series will explore how to accomplish distributed data management using SAS Viya. In my next article, we will discuss how SAS programmers can collaborate with their open source colleagues to leverage SAS Viya for distributed data management.

Distributed Data Management

SAS Viya provides a robust, scalable, cloud ready distributed data management platform. This platform provides multiple techniques for data management that run distributive, i.e. using all cores on all compute nodes defined to the SAS Viya platform. The four techniques we will explore here are DATA Step, PROC DS2, PROC FEDSQL and PROC TRANSPOSE. With these four techniques SAS programmers and open source programmers can quickly apply complex business rules that stage data for downstream consumption, i.e., Analytics, visualizations, and reporting.

The rule for getting your code to run distributed is to ensure all source and target tables reside in the In-Memory component of SAS Viya i.e., Cloud Analytic Services (CAS).

Starting CAS

The following statement is an example of starting a new CAS session. In the coding examples that follow we will reference this session using the key word MYSESS. Also note, this CAS session is using one of the default CAS library, CASUSER.

Binding a LIBNAME to a CAS session

Now that we have started a CAS session we can bind a LIBNAME to that session using the following syntax:

Note: CASUSER is one of the default CAS libraries created when you start a CAS session. In the following coding examples we will utilize CASUSER for our source and target tables that reside in CAS.

To list all default and end-user CAS libraries, use the following statement:

Click here for more information on CAS libraries.

THREAD program

  • The PROC DS2 DATA program must declare a THREAD program
  • The source and target tables must reside in CAS
  • Unlike DATA Step, with PROC DS2 you use the SESSREF= parameter to identify which CAS environment the source and target tables reside in
  • SESSREF=

     For PROC TRANSPOSE to run in CAS the rules are:

    1. All source and target tables must reside in CAS
      a.   Like DATA Step you use a two-level name to reference these tables

    Collaborative distributed data management using SAS Viya was published on SAS Users.

    162017
     

    There have been some rather hysterical headlines in the UK recently about immigration. Eyebrow-raising statements alluding to the Home Office (the government department responsible for immigration) losing thousands of asylum seekers illustrate that efforts to trace them are placing huge pressure on resources. This, and the more outward looking post-Brexit [...]

    Why our future prosperity demands smart borders was published on SAS Voices by Peter Snelling

    152017
     

    Omnichannel Analytics are helping companies uncover patterns in big data to improve the customer experience.  Using those insights, companies can anticipate what consumers are planning to purchase and influence that purchase in real time.     Companies are experiencing unprecedented complexity as they look for growth and market opportunities. Their product portfolios are [...]

    Omnichannel is changing the way we view demand planning was published on SAS Voices by Charlie Chase

    152017
     

    Omnichannel Analytics are helping companies uncover patterns in big data to improve the customer experience.  Using those insights, companies can anticipate what consumers are planning to purchase and influence that purchase in real time.     Companies are experiencing unprecedented complexity as they look for growth and market opportunities. Their product portfolios are [...]

    Omnichannel is changing the way we view demand planning was published on SAS Voices by Charlie Chase

    152017
     

    SAS programmers who have experience with other programming languages sometimes wonder whether the SAS language supports statements that are equivalent to the "break" and "continue" statements in other languages. The answer is yes. The LEAVE statement in the SAS DATA step is equivalent to the "break" statement. It provides a way to immediately exit from an iterative loop. The CONTINUE statements in the SAS DATA step skips over any remaining statements in the body of a loop and starts the next iteration.

    Not all languages in SAS support those statements. For example, the SAS/IML language does not. However, you can use an alternative syntax to implement the same logical behavior, as shown in this article.

    To review the syntax of various DO, DO-WHILE, and DO-UNTIL loops in SAS, see "Loops in SAS."

    The LEAVE statement

    The LEAVE statement exits a DO loop, usually as part of an IF-THEN statement to test whether a certain condition is met.

    To illustrate the LEAVE statement consider a DATA step that simulates tossing a coin until "heads" appears. (Represent "tails" by a 0 and "heads" by a 1, chosen at random.) In the following SAS DATA step, the DO WHILE statement is always true, so the program potentially contains an infinite loop. However, the LEAVE statement is used to break out of the loop when "heads" appears. This coin-tossing experiment is repeated 100 times, which is equivalent to 100 draws from the geometric distribution:

    /* toss a coin until "heads" (1) */
    data Toss;
    call streaminit(321);
    do trial = 1 to 100;               /* simulate an experiment 100 times */
       count = 0;                      /* how many tosses until heads? */
       do while (1);                   /* loop forever */
          coin = rand("Bernoulli", 0.5);  /* random 0 or 1 */
          if coin = 1 then LEAVE;      /* exit loop when "heads" */
          count + 1;                   /* otherwise increment count */
       end;
       output;
    end;
    keep trial count;
    run;

    Some people like this programming paradigm (set up an infinite loop, break out when a condition is satisfied), but I personally prefer a DO UNTIL loop because the exit condition is easier to see when I read the program. For example, the code for each trial could be rewritten as

       count  = 0;                     /* how many tosses until heads? */
       done = 0;                       /* initialize flag variable */
       do until (done);                /* exit loop when "heads" */
          coin = rand("Bernoulli", 0.5);  /* random 0 or 1 */
          done = (coin = 1);           /* update flag variable */
          if ^done then                /* otherwise increment count */
             count + 1;
       end;
       output;

    Notice that the LEAVE statement exits only the inner loop. In this example, the LEAVE statement does n ot affect the iteration of the DO TRIAL loop.

    The CONTINUE statement

    The CONTINUE statement tells the DATA step to skip the remaining body of the loop and go to the next iteration. It is used to skip processing when a condition is true. To illustrate the CONTINUE statement, let's simulate a coin-tossing experiment in which you toss a coin until "heads" appears OR until you have tossed the coin five times. In the following SAS DATA step, if tails (0) appears the CONTINUE statement executes, which skips the remaining statements and begins the next iteration of the loop. Consequently, the DONE=1 assignment is not executed when coin=0. Only if heads (1) appears does the DONE variable get assigned to a nonzero value, thereby ending the DO-UNTIL loop:

    data Toss2;
    call streaminit(321);
    do trial = 1 to 100;               /* simulate an experiment 100 times */
       done = 0;                       /* initialize flag variable */
       do count = 0 to 4 until (done); /* iterate at most 5 times */
          coin = rand("Bernoulli", 0.5);  /* random 0 or 1 */
          if coin = 0 then CONTINUE;   /* tails: go to next iteration */
          done = 1;                    /* exit loop when "heads" */
       end;
       output;
    end;
    keep trial count;
    run

    The CONTINUE statement is not strictly necessary, although it can be convenient. You can always use an IF-THEN statement to bypass the remainder of the loop, as follows:

       coin = rand("Bernoulli", 0.5);  /* random 0 or 1 */
       /* wrap the remainder of the body in an IF-THEN statement */
       if coin ^= 0 then do;           /* heads: abort the loop */
          done = 1;                    /* exit loop when "heads" */
          /* other computations, as needed */
       end;

    The CONTINUE and the LEAVE statements are examples of "jump statements" that tell the program the location of the next statement to execute. Both statements jump to a statement that might be far away. Consequently, programs that contain these statements are less structured than programs that avoid them. I try to avoid these statements in my programs, although sometimes the LEAVE statement is the simplest way to abort a loop when the program has to check for multiple exit conditions.

    While we are on the topic, another jump statement in SAS is the GOTO statement, which can be used to emulate the behavior of LEAVE and CONTINUE. I avoid the GOTO statement because I think programs are easier to read and maintain when the logical flow of the program is controlled by using the DO-WHILE, DO-UNTIL, and IF-THEN statements. I also use those control statements in the SAS/IML language, which does not support the CONTINUE or LEAVE statements (although it does support the GOTO statement).

    What are your views? Do you use the CONTINUE or LEAVE statement to simplify the error-handling logic of your programs? Or do you avoid them in favor of a more structured programming style? Why?

    The post LEAVE and CONTINUE: Two ways to control the flow in a SAS DO loop appeared first on The DO Loop.

    142017
     

    Image recognition is a hot and hyped topic in machine learning, artificial intelligence and other technology circles. Computer vision technology is essential for realizing advancements like driverless cars, face recognition, medical outcomes predictions, and a host of other breakthrough innovations. Amidst the hype, organizations large and small are trying to understand the [...]

    Image recognition: Cutting edge data science ready for business was published on SAS Voices by Andrew Pease