tensorflow work function with data - tensorflow

I have a question. For example, I have an array and want to change their boundary values. I want to write a function that changes these values. I get an array to this function.
The question is does these function link to these array or copy it?
Best regards,
Elijah.

Values of nodes are immutable. Only variables can be modified.
If you have an operation that changes some of the values it will produce a different array.
It's not specified if it's modified in place or first copied and then modified. That is implementation dependent.

Related

Data Factory expression substring? Is there a function similar like right?

Please help,
How could I extract 2019-04-02 out of the following string with Azure data flow expression?
ABC_DATASET-2019-04-02T02:10:03.5249248Z.parquet
The first part of the string received as a ChildItem from a GetMetaData activity is dynamically. So in this case it is ABC_DATASET that is dynamic.
Kind regards,
D
There are several ways to approach this problem, and they are really dependent on the format of the string value. Each of these approaches uses Derived Column to either create a new column or replace the existing column's value in the Data Flow.
Static format
If the format is always the same, meaning the length of the sections is always the same, then substring is simplest:
This will parse the string like so:
Useful reminder: substring and array indexes in Data Flow are 1-based.
Dynamic format
If the format of the base string is dynamic, things get a tad trickier. For this answer, I will assume that the basic format of {variabledata}-{timestamp}.parquet is consistent, so we can use the hyphen as a base delineator.
Derived Column has support for local variables, which is really useful when solving problems like this one. Let's start by creating a local variable to convert the string into an array based on the hyphen. This will lead to some other problems later since the string includes multiple hyphens thanks to the timestamp data, but we'll deal with that later. Inside the Derived Column Expression Builder, select "Locals":
On the right side, click "New" to create a local variable. We'll name it and define it using a split expression:
Press "OK" to save the local and go back to the Derived Column. Next, create another local variable for the yyyy portion of the date:
The cool part of this is I am now referencing the local variable array that I created in the previous step. I'll follow this pattern to create a local variable for MM too:
I'll do this one more time for the dd portion, but this time I have to do a bit more to get rid of all the extraneous data at the end of the string. Substring again turns out to be a good solution:
Now that I have the components I need isolated as variables, we just reconstruct them using string interpolation in the Derived Column:
Back in our data preview, we can see the results:
Where else to go from here
If these solutions don't address your problem, then you have to get creative. Here are some other functions that may help:
regexSplit
left
right
dropLeft
dropRight

Alternative to case statments when changing a lot of numeric controls

I'm pretty new to LabVIEW, but I do have experience in other programing languages like Python and C++. The code I'm going to ask about works, but there was a lot of manual work involved when putting it together. Basically I read from a text file and change control values based on values in the text file, in this case its 40 values.
I have set it up to pull from a text file and split the string by commas. Then I loop through all the values and set the indicator to read the corresponding value. I had to create 40 separate case statements to achieve this. I'm sure there is a better way of doing this. Does anyone have any suggestions?
There could be done following improvements (additionally to suggested by sweber:
If file contains just data, without "label - value" format, then you could read it as csv (comma separated values) format, and read actually just 1st row.
Currently, you set values based on order. In this case, you could: create reference to all indicators, build them to array in proper order, in For Loop assign values to indicators via property node Value.
Overall, I support sweber that if it is some key - value data, then better to use either JSON format, or .ini file format, which support such structure.
Let's start with some optimization:
It seems your data file contains nothing more than just 40 numbers. You can wire an 1D DBL array to the default input of the string-to-array VI, and you will get just a 1D array out. No need for a 2D array.
Second, there is no need to convert the FOR index value to a string, the CASE accepts integers, too.
Now, about your question: The simplest solution is to display the values as array, just as they come from the string-to-array VI.
But I guess each value has a special meaning, and you would like to display it's name/description somehow. In this case, create a cluster with 40 values, edit their labels as you like, and make sure their order in the cluster is the same as the order of the values in the files.
Then, wire the 1D array of values to this cluster via an array-to-cluster VI.
If you plan to use the text file to store and load the values, converting the cluster data to JSON and vv. might be something for you, as it transports the labels of the cluster into the file, too. (However, changing labels is an issue, then)

Why pandas.Series.values drops some scalar data exists in original Series?

I have a pandas.Series object docs of which scalar values are string.
when I tries to iterate over docs.values, for example make list(docs), some of the scalar entries are dropped, or become a NoneType.
For instance, given target_index is an index with buggy issue, when I check docs[target_index], it returns a string data. However, when I execute list(docs)[target_index], it returns None.
Since pandas.Series.values turn data into numpy.ndarray, I guess the issue has something to do with numpy data type or something, but I cannot figure out whats going wrong exactly.
Here is the buggy json file of dataframe
https://gist.github.com/goodcheer/f9c990171a57ff053b4b0539396f63f6
docs is the profile column series

Pentaho Data Integration - Pass dynamic value for 'Add sequence' as Start

Can we pass any dynamic value (which is the max value of another table column) in "Start at Value" in ADD Sequence step.
Please guide me.
Yes, but as the step is written you'll have to be sneaky about it.
Create two transforms and wrap them up in a job. In the first transform, query that database to get the value you want, then store it in a variable. Then in the second transform, which you should execute in the job after the first, in the Add Sequence step use variable substitution on the Start at Value field to sub in the value you previously extracted from the earlier transform.
Note that you can't do this all in one transform because there is no way to ensure that the variable will be set before the Add Sequence step (although it might seem like Wait steps would make this possible, I've tried it in the past and was unsuccessful and so had to go with the methods described above).

Define initialized arrays in functions and return values based on user input Visual Basic

In this application I need to allow users to enter a month as integer (1-12) then use integer tryparse to validate that input, that seems to be the easy part. I need two create two functions, one that returns the name of the month and the other returns the number of days in that month. The arrays are supposed to be defined and initialized within the function so that the main program can take the user input and call the two functions, then return the appropriate values as output to labels. I am not sure how to declare the arrays in their appropriate functions and then how to call those functions to retrieve the right value from the function.
Since this is homework I'm not gonna write the code for you, but this should be pretty simple. Assuming the number is in the textbox and the user presses the OK button (or whatever the functionality is), the code for that OK button should include calls to the two functions you create, let's say GetMonth and GetDays.
GetMonth would take an integer, and frankly, I don't really see the need for declaring any arrays here. If the array declaration is part of your assignment then you can do that, but it just doesn't seem necessary. A simple Select...Case statement seems more straightforward: you just set up the cases for the integer being passed into the function, 1-12, and return the month's string. Similarly for GetDays, just set up cases 1-12 and return the number of days.
If you're unfamiliar with any of this, take a look at these MSDN articles; they should point you in the right direction:
Functions
Cases
Arrays
Hope this helps!
Edit: Realized I never expanded on how you could do this with arrays anyway (meant to, sorry). You would just create two string arrays of size 12 (or one string array, one integer array), and then define each of the 12 elements in each array as whatever month or number of days you need. Then in the function, just return something like arrayDays[x], where x is the input being passed in. (If you want to be fancy, you could create a 12x2 string array and store all the information in one place.) But I'm pretty sure it'll take slightly less code to do a Select...Case statement (it just seems more direct to me).