Skip to main content

DesignScript

It’s been a really long time that I wrote about something. For past many years, I have been busy working on a domain specific language called DesignScript and it's visual programming interface Dynamo. I am now moving to a world of reality-capture and I’ll miss working on this technology. I find this technology very useful and every now and then I’ll keep coming to it for some geometric and programming experiment. Recently I am learning machine learning and wondering if I can use Dynamo to explain some of the concepts of machine learning. I’ll explore it further but in the mean time let me explain what is DesignScript and Dynamo.

DesignScript is a scripting language intended to provide programming capability to designers. Designers can now describe their design-intent effectively using this language. Unlike other procedural languages, it provides two great features such as associativity and replication. The associativity in expressions helps it preserve the intent whereas the replication makes it agnostic to the dimensionality of the data. One can establish relationships easily by defining expressions where left-hand side depends on the parameters used in the right-hand side of the expression. e.g.

a = 5;
b = 2 * a; //‘b’ is twice the value of ‘a’, thus ‘b’ depends on ‘a';

The relationship defined by such expressions are associative in nature, i.e. whenever the dependent parameter(s)/variable(s) is(are) modified the left-hand side variable is automatically updated. And the evaluation of this expression is agnostic to the dimensionality of the parameters used in the expression. The parameter ‘a’ in above expression is a singleton value, but later in the program, if we change the value of a to a collection then the expression gets re-evaluated and ‘b’ is updated to a collection, which means we don’t need to run a for-loop to evaluate the expression.

a= 1..5; //‘a’ is a collection of integers from 1 to 5 and now b = {2, 4, 6, 8, 10} due to associativity of ‘b = 2 * a;’ expression.

There are few other features such as zero touch library import allows users to import any .NET library into DesignScript without modifying the library and the public class and methods defined in the library can be called seamlessly from DesignScript.

Dynamo provides a visual programming interface to DesignScript users. They can define their programming logic as a data flow program. Dynamo also support python scripts and users can creates a reusable script using custom nodes. They can also publish their workflow for others to consume it in their design using package manager. More about DesignScript and Dynamo can be learned from http://dynamoprimer.com/ or http://dynamobim.org

Popular posts from this blog

Linear Regression in Dynamo

Today we are collecting more data than ever but making sense out of the data is very challenging. Machine learning helps us analyze the data and build an analytical model to help us with future prediction. To create a machine learning prediction model we usually develop a hypothesis based on our observation of the collected data and fine tune the model to reduce the cost function by training the model. One of the very simple hypothesis we can develop by assuming a linear relationship between input and output parameters.

Suppose we have data on housing price and we assume that housing prices are linearly related to the floor area of the house then we can use linear regression to predict the price of a house with specific floor area. One of the most important steps towards building the hypothesis is being able to visualize the data and understand the trend. So let first draw a scatter plot of our data as shown in the figure below. I am using Grapher package to draw the scatter plot.
T…

Polynomial regression and model comparison

Welcome back, in my previous post I described how we can perform linear regression using normal equation in Dynamo and I left with a question "what if the input and output are not linearly dependent?” Let’s say we have a hypothesis that the housing price doesn’t depend on floor area and number of rooms linearly but it has a following relationship as y = a_{0} * x_{0} + a_{1} * x_{1} + a_{2} * x_{2} + a_{3} * x_{1} * x_{2} + a_{4} * x_{1}^2 + a_{5} * x_{2}^2 \: where x_{0} = 1, \: x_{1} is floor area and x_{2} is number of rooms. Then we can introduce few new parameters x_{3} = x_{1} * x_{2}, \: x_{4} = x_{1}^2, \: x_{5} = x_{2}^2 and then perform the linear regression to find the coefficient matrix.

The Dynamo graph to setup the feature vector looks as follows. Once the feature vector is setup rest all is same as previous linear regression example.


Note that the price prediction for a given floor area and rooms we need to again construct the same feature vector. The price predic…

What’s Intent?

Every action has equal and opposite reaction but today we need to know the intent behind an action to react properly. If you can understand the intent you are smart. So what’s the intent, how do you understand it? It’s a thought, an idea, a concept which can be derived from the context by reading between the lines or understanding the gestures. It’s understanding of “I in you”.
Understanding intent leads to providing the best solution for a problem, it leads to innovation. For example, searching for a restaurant on mobile phone has an intent and providing the best search result based on the context/location is innovation. In design paradigm every entity drawn on the canvas has some intent and it can be modified meaningfully only if one understand the intent of the entity. But when author is changed or the tools to modify these entities are changed, most often intents are lost. Capturing intent from actions develops knowledge base and developing knowledge base helps us understand the …