markdown
stringlengths
0
1.02M
code
stringlengths
0
832k
output
stringlengths
0
1.02M
license
stringlengths
3
36
path
stringlengths
6
265
repo_name
stringlengths
6
127
Unlike arrays, sequences are flat. The sequence (3) is identical to the integer 3, and (1, (2, 3)) is identical to (1, 2, 3). A bit more in depth VariablesYou can bind a sequence of values to a (dollar-prefixed) variable, like so:
%%jsoniq let $x := "Bearing 3 1 4 Mark 5. " return concat($x, "Engage!") %%jsoniq let $x := ("Kirk", "Picard", "Sisko") return string-join($x, " and ")
Took: 0.006165742874145508 ms "Kirk and Picard and Sisko"
Apache-2.0
RumbleSandbox.ipynb
Sparksoniq/sparksoniq
You can bind as many variables as you want:
%%jsoniq let $x := 1 let $y := $x * 2 let $z := $y + $x return ($x, $y, $z)
Took: 0.006880044937133789 ms 1 2 3
Apache-2.0
RumbleSandbox.ipynb
Sparksoniq/sparksoniq
and even reuse the same name to hide formerly declared variables:
%%jsoniq let $x := 1 let $x := $x + 2 let $x := $x + 3 return $x
Took: 0.006127119064331055 ms 6
Apache-2.0
RumbleSandbox.ipynb
Sparksoniq/sparksoniq
IterationIn a way very similar to let, you can iterate over a sequence of values with the "for" keyword. Instead of binding the entire sequence of the variable, it will bind each value of the sequence in turn to this variable.
%%jsoniq for $i in 1 to 10 return $i * 2
Took: 0.006555080413818359 ms 2 4 6 8 10 12 14 16 18 20
Apache-2.0
RumbleSandbox.ipynb
Sparksoniq/sparksoniq
More interestingly, you can combine fors and lets like so:
%%jsoniq let $sequence := 1 to 10 for $value in $sequence let $square := $value * 2 return $square
Took: 0.006516933441162109 ms 2 4 6 8 10 12 14 16 18 20
Apache-2.0
RumbleSandbox.ipynb
Sparksoniq/sparksoniq
and even filter out some values:
%%jsoniq let $sequence := 1 to 10 for $value in $sequence let $square := $value * 2 where $square < 10 return $square
Took: 0.0077419281005859375 ms 2 4 6 8
Apache-2.0
RumbleSandbox.ipynb
Sparksoniq/sparksoniq
Note that you can only iterate over sequences, not arrays. To iterate over an array, you can obtain the sequence of its values with the [] operator, like so:
%%jsoniq [1, 2, 3][]
Took: 0.006000041961669922 ms 1 2 3
Apache-2.0
RumbleSandbox.ipynb
Sparksoniq/sparksoniq
ConditionsYou can make the output depend on a condition with an if-then-else construct:
%%jsoniq for $x in 1 to 10 return if ($x < 5) then $x else -$x
Took: 0.0064771175384521484 ms 1 2 3 4 -5 -6 -7 -8 -9 -10
Apache-2.0
RumbleSandbox.ipynb
Sparksoniq/sparksoniq
Note that the else clause is required - however, it can be the empty sequence () which is often when you need if only the then clause is relevant to you. Composability of ExpressionsNow that you know of a couple of elementary JSONiq expressions, you can combine them in more elaborate expressions. For example, you can ...
%%jsoniq [ 1 to 10 ]
Took: 0.007096052169799805 ms [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
Apache-2.0
RumbleSandbox.ipynb
Sparksoniq/sparksoniq
Or you can dynamically compute the value of object pairs (or their key):
%%jsoniq { "Greeting" : (let $d := "Mister Spock" return concat("Hello, ", $d)), "Farewell" : string-join(("Live", "long", "and", "prosper"), " ") }
Took: 0.007810831069946289 ms {"Greeting": "Hello, Mister Spock", "Farewell": "Live long and prosper"}
Apache-2.0
RumbleSandbox.ipynb
Sparksoniq/sparksoniq
You can dynamically generate object singletons (with a single pair):
%%jsoniq { concat("Integer ", 2) : 2 * 2 }
Took: 0.006745100021362305 ms {"Integer 2": 4}
Apache-2.0
RumbleSandbox.ipynb
Sparksoniq/sparksoniq
and then merge lots of them into a new object with the {| |} notation:
%%jsoniq {| for $i in 1 to 10 return { concat("Square of ", $i) : $i * $i } |}
Took: 0.006300926208496094 ms {"Square of 1": 1, "Square of 2": 4, "Square of 3": 9, "Square of 4": 16, "Square of 5": 25, "Square of 6": 36, "Square of 7": 49, "Square of 8": 64, "Square of 9": 81, "Square of 10": 100}
Apache-2.0
RumbleSandbox.ipynb
Sparksoniq/sparksoniq
JSON NavigationUp to now, you have learnt how to compose expressions so as to do some computations and to build objects and arrays. It also works the other way round: if you have some JSON data, you can access it and navigate.All you need to know is: JSONiq viewsan array as an ordered list of values,an object as a set...
%%jsoniq let $person := { "first name" : "Sarah", "age" : 13, "gender" : "female", "friends" : [ "Jim", "Mary", "Jennifer"] } return $person."first name"
Took: 0.009386062622070312 ms "Sarah"
Apache-2.0
RumbleSandbox.ipynb
Sparksoniq/sparksoniq
You can also ask for all keys in an object:
%%jsoniq let $person := { "name" : "Sarah", "age" : 13, "gender" : "female", "friends" : [ "Jim", "Mary", "Jennifer"] } return { "keys" : [ keys($person)] }
Took: 0.00790095329284668 ms {"keys": ["name", "age", "gender", "friends"]}
Apache-2.0
RumbleSandbox.ipynb
Sparksoniq/sparksoniq
ArraysThe [[]] operator retrieves the entry at the given position:
%%jsoniq let $friends := [ "Jim", "Mary", "Jennifer"] return $friends[[1+1]]
Took: 0.00620579719543457 ms "Mary"
Apache-2.0
RumbleSandbox.ipynb
Sparksoniq/sparksoniq
It is also possible to get the size of an array:
%%jsoniq let $person := { "name" : "Sarah", "age" : 13, "gender" : "female", "friends" : [ "Jim", "Mary", "Jennifer"] } return { "how many friends" : size($person.friends) }
Took: 0.006299018859863281 ms {"how many friends": 3}
Apache-2.0
RumbleSandbox.ipynb
Sparksoniq/sparksoniq
Finally, the [] operator returns all elements in an array, as a sequence:
%%jsoniq let $person := { "name" : "Sarah", "age" : 13, "gender" : "female", "friends" : [ "Jim", "Mary", "Jennifer"] } return $person.friends[]
Took: 0.0063228607177734375 ms "Jim" "Mary" "Jennifer"
Apache-2.0
RumbleSandbox.ipynb
Sparksoniq/sparksoniq
Relational AlgebraDo you remember SQL's SELECT FROM WHERE statements? JSONiq inherits selection, projection and join capability from XQuery, too.
%%jsoniq let $stores := [ { "store number" : 1, "state" : "MA" }, { "store number" : 2, "state" : "MA" }, { "store number" : 3, "state" : "CA" }, { "store number" : 4, "state" : "CA" } ] let $sales := [ { "product" : "broiler", "store number" : 1, "quantity" : 20 }, { "product" : "toaster", "st...
_____no_output_____
Apache-2.0
RumbleSandbox.ipynb
Sparksoniq/sparksoniq
Access datasetsRumbleDB can read input from many file systems and many file formats. If you are using our backend, you can only use json-doc() with any URI pointing to a JSON file and navigate it as you see fit. You can read data from your local disk, from S3, from HDFS, and also from the Web. For this tutorial, we'll...
%%jsoniq json-file("http://rumbledb.org/samples/products-small.json", 10)[1]
Took: 5.183954954147339 ms {"product": "blender", "store-number": 20, "quantity": 920}
Apache-2.0
RumbleSandbox.ipynb
Sparksoniq/sparksoniq
The second parameter to json-file, 10, indicates to RumbleDB that it should organize the data in ten partitions after downloading it, and process it in parallel. If you were reading from HDFS or S3, the parallelization of these partitions would be pushed down to the distributed file system.JSONiq supports the relationa...
%%jsoniq for $product in json-file("http://rumbledb.org/samples/products-small.json", 10) where $product.quantity ge 995 return $product
Took: 5.105026006698608 ms "Warning! The output sequence contains 600 items but its materialization was capped at 200 items. This value can be configured with the result-size parameter in the query string of the HTTP request." {"product": "toaster", "store-number": 97, "quantity": 997} {"product": "phone", "store-numbe...
Apache-2.0
RumbleSandbox.ipynb
Sparksoniq/sparksoniq
Notice that by default only the first 200 items are shown. In a typical setup, it is possible to output the result of a query to a distributed system, so it is also possible to output all the results if needed. In this case, however, as this is printed on your screen, it is more convenient not to materialize the entire...
%%jsoniq for $product in json-file("http://rumbledb.org/samples/products-small.json", 10) where $product.quantity ge 995 return project($product, ("store-number", "product"))
Took: 8.84467601776123 ms "Warning! The output sequence contains 600 items but its materialization was capped at 200 items. This value can be configured with the result-size parameter in the query string of the HTTP request." {"store-number": 97, "product": "toaster"} {"store-number": 100, "product": "phone"} {"store-n...
Apache-2.0
RumbleSandbox.ipynb
Sparksoniq/sparksoniq
You can also page the results (like OFFSET and LIMIT in SQL) with a count clause and a where clause
%%jsoniq for $product in json-file("http://rumbledb.org/samples/products-small.json", 10) where $product.quantity ge 995 count $c where $c gt 10 and $c le 20 return project($product, ("store-number", "product"))
Took: 11.857532024383545 ms {"store-number": 95, "product": "blender"} {"store-number": 98, "product": "tv"} {"store-number": 97, "product": "shirt"} {"store-number": 100, "product": "toaster"} {"store-number": 96, "product": "blender"} {"store-number": 99, "product": "tv"} {"store-number": 95, "product": "broiler"} {"...
Apache-2.0
RumbleSandbox.ipynb
Sparksoniq/sparksoniq
JSONiq also supports grouping with a group by clause:
%%jsoniq for $product in json-file("http://rumbledb.org/samples/products-small.json", 10) group by $store-number := $product.store-number return { "store" : $store-number, "count" : count($product) }
Took: 7.4556567668914795 ms {"store": 64, "count": 1000} {"store": 68, "count": 1000} {"store": 42, "count": 1000} {"store": 83, "count": 1000} {"store": 54, "count": 1000} {"store": 82, "count": 1000} {"store": 96, "count": 1000} {"store": 78, "count": 1000} {"store": 41, "count": 1000} {"store": 89, "count": 1000} {"...
Apache-2.0
RumbleSandbox.ipynb
Sparksoniq/sparksoniq
As well as ordering with an order by clause:
%%jsoniq for $product in json-file("http://rumbledb.org/samples/products-small.json", 10) group by $store-number := $product.store-number order by $store-number ascending return { "store" : $store-number, "count" : count($product) }
Took: 9.933311939239502 ms {"store": 1, "count": 1000} {"store": 2, "count": 1000} {"store": 3, "count": 1000} {"store": 4, "count": 1000} {"store": 5, "count": 1000} {"store": 6, "count": 1000} {"store": 7, "count": 1000} {"store": 8, "count": 1000} {"store": 9, "count": 1000} {"store": 10, "count": 1000} {"store": 11...
Apache-2.0
RumbleSandbox.ipynb
Sparksoniq/sparksoniq
JSONiq supports denormalized data, so you are not forced to aggregate after a grouping, you can also nest data like so:
%%jsoniq for $product in json-file("http://rumbledb.org/samples/products-small.json", 10) group by $store-number := $product.store-number order by $store-number ascending return { "store" : $store-number, "products" : [ distinct-values($product.product) ] }
Took: 11.702539920806885 ms {"store": 1, "products": ["shirt", "toaster", "phone", "blender", "tv", "socks", "broiler"]} {"store": 2, "products": ["shirt", "toaster", "phone", "blender", "tv", "socks", "broiler"]} {"store": 3, "products": ["shirt", "toaster", "phone", "blender", "tv", "socks", "broiler"]} {"store": 4, ...
Apache-2.0
RumbleSandbox.ipynb
Sparksoniq/sparksoniq
Or
%%jsoniq for $product in json-file("http://rumbledb.org/samples/products-small.json", 10) group by $store-number := $product.store-number order by $store-number ascending return { "store" : $store-number, "products" : [ project($product[position() le 10], ("product", "quantity")) ], "inventory" : sum($produ...
Took: 13.3197660446167 ms {"store": 1, "products": [{"product": "shirt", "quantity": 901}, {"product": "toaster", "quantity": 801}, {"product": "phone", "quantity": 701}, {"product": "blender", "quantity": 601}, {"product": "tv", "quantity": 501}, {"product": "socks", "quantity": 401}, {"product": "broiler", "quantity"...
Apache-2.0
RumbleSandbox.ipynb
Sparksoniq/sparksoniq
Aggregating statistics
import pandas as pd air_quality = pd.read_pickle('air_quality.pkl') air_quality.info()
<class 'pandas.core.frame.DataFrame'> RangeIndex: 95685 entries, 0 to 95684 Data columns (total 27 columns): # Column Non-Null Count Dtype --- ------ -------------- ----- 0 date_time 95685 non-null datetime64[ns] 1 PM2.5 956...
MIT
Exploring+data+(Exploratory+Data+Analysis)+(1).ipynb
PacktPublishing/Python-for-Data-Analysis-step-by-step-with-projects-
Series/one column of a DataFrame
air_quality['TEMP'].count() air_quality['TEMP'].mean() air_quality['TEMP'].std() air_quality['TEMP'].min() air_quality['TEMP'].max() air_quality['TEMP'].quantile(0.25) air_quality['TEMP'].median() air_quality['TEMP'].describe() air_quality['RAIN'].sum() air_quality['PM2.5_category'].mode() air_quality['PM2.5_category']...
_____no_output_____
MIT
Exploring+data+(Exploratory+Data+Analysis)+(1).ipynb
PacktPublishing/Python-for-Data-Analysis-step-by-step-with-projects-
DataFrame by columns
air_quality.count() air_quality.mean() air_quality.mean(numeric_only=True) air_quality[['PM2.5', 'TEMP']].mean() air_quality[['PM2.5', 'TEMP']].min() air_quality[['PM2.5', 'TEMP']].max() air_quality.describe().T air_quality.describe(include=['object', 'category', 'bool']) air_quality[['PM2.5_category', 'TEMP_category',...
_____no_output_____
MIT
Exploring+data+(Exploratory+Data+Analysis)+(1).ipynb
PacktPublishing/Python-for-Data-Analysis-step-by-step-with-projects-
DataFrame by rows
air_quality[['PM2.5', 'PM10']] air_quality[['PM2.5', 'PM10']].min() air_quality[['PM2.5', 'PM10']].min(axis=1) air_quality[['PM2.5', 'PM10']].mean(axis=1) air_quality[['PM2.5', 'PM10']].sum(axis=1)
_____no_output_____
MIT
Exploring+data+(Exploratory+Data+Analysis)+(1).ipynb
PacktPublishing/Python-for-Data-Analysis-step-by-step-with-projects-
Grouping by
air_quality.groupby(by='PM2.5_category') air_quality.groupby(by='PM2.5_category').groups air_quality['PM2.5_category'].head(20) air_quality.groupby(by='PM2.5_category').groups.keys() air_quality.groupby(by='PM2.5_category').get_group('Good') air_quality.sort_values('date_time') air_quality.sort_values('date_time').grou...
_____no_output_____
MIT
Exploring+data+(Exploratory+Data+Analysis)+(1).ipynb
PacktPublishing/Python-for-Data-Analysis-step-by-step-with-projects-
Pivoting tables
import pandas as pd student = pd.read_csv('student.csv') student.info() student pd.pivot_table(student, index='sex') pd.pivot_table(student, index=['sex', 'internet'] ) pd.pivot_table(student, index=['sex', 'internet'], values='score') pd.piv...
_____no_output_____
MIT
Exploring+data+(Exploratory+Data+Analysis)+(1).ipynb
PacktPublishing/Python-for-Data-Analysis-step-by-step-with-projects-
Getting Started with CRESTCREST is a hybrid modelling DSL (domain-specific language) that focuses on the flow of resources within cyber-physical systems (CPS).CREST is implemented in the Python programming language as the `crestdsl` internal DSL and shipped as Python package. `crestdsl`'s source code is hosted on Git...
print("Try executing this cell, so you ge a feeling for it.") 2 + 2 # this should print "Out[X]: 4" directly underneath (X will be an index)
_____no_output_____
MIT
GettingStarted.ipynb
stklik/crestdsl-docker
Defining a `crestdsl` Model Import `crestdsl`In order to use `crestdsl`, you have to import it.Initially, we will create work towards creating a system model, so let's import the `model` subpackage.
import crestdsl.model as crest
_____no_output_____
MIT
GettingStarted.ipynb
stklik/crestdsl-docker
Define Resources First, it is necessary to define the resource types that will be used in the application.In CREST and `crestdsl`, resources are combinations of resource names and their value domains.Value domains can be infinite, such as Real and Integers or discrete such as `["on", "off"]`, as shown for the switch.
electricity = crest.Resource("Watt", crest.REAL) switch = crest.Resource("switch", ["on", "off"]) light = crest.Resource("Lumen", crest.INTEGER) counter = crest.Resource("Count", crest.INTEGER) time = crest.Resource("minutes", crest.REAL) celsius = crest.Resource("Celsius", crest.REAL) fahrenheit = crest.Resource("Fahr...
_____no_output_____
MIT
GettingStarted.ipynb
stklik/crestdsl-docker
Our First EntityIn CREST any system or component is modelled as Entity.Entities can be composed hierachically (as we will see later).To model an entity, we define a Python class that inherits from `crest.Entity`.Entities can define - `Input`, `Output` and `Local` ports (variables), - `State` objects and a `current` ...
class LightElement(crest.Entity): """This is a definition of a new Entity type. It derives from CREST's Entity base class.""" """we define ports - each has a resource and an initial value""" electricity_in = crest.Input(resource=electricity, value=0) light_out = crest.Output(resource=light, value=0...
_____no_output_____
MIT
GettingStarted.ipynb
stklik/crestdsl-docker
Visualising EntitiesBy default, CREST is a graphical language. Therefore it only makes sense to implement a graphical visualisation of `crestdsl` systems.One of the plotting engines is defined in the `crestdsl.ui` module.The code below produces an interactive HTML output. You can easily interact with the model to expl...
# import the plotting libraries that can visualise the CREST systems from crestdsl.ui import plot plot(LightElement())
_____no_output_____
MIT
GettingStarted.ipynb
stklik/crestdsl-docker
Define Another Entity (The HeatElement)It's time to model the heating component of our growing lamp.Its functionality is simple: if the `switch_in` input is `on`, 1% of the electricity is converted to addtional heat under the lamp.Thus, for example, by providing 100 Watt, the temperature underneath the lamp grows by 1...
class HeatElement(crest.Entity): """ Ports """ electricity_in = crest.Input(resource=electricity, value=0) switch_in = crest.Input(resource=switch, value="off") # the heatelement has its own switch heat_out = crest.Output(resource=celsius, value=0) # and produces a celsius value (i.e. the temperat...
_____no_output_____
MIT
GettingStarted.ipynb
stklik/crestdsl-docker
Adder - A Logical EntityCREST does not specify a special connector type that defines what is happening for multiple incoming influence, etc. Instead standard entities are used to define add, minimum and maximum calculation which is then written to the actual target port using an influence.We call such entities *logica...
# a logical entity can inherit from LogicalEntity, # to emphasize that it does not relate to the real world class Adder(crest.LogicalEntity): heat_in = crest.Input(resource=celsius, value=0) room_temp_in = crest.Input(resource=celsius, value=22) temperature_out = crest.Output(resource=celsius, value=22) ...
_____no_output_____
MIT
GettingStarted.ipynb
stklik/crestdsl-docker
Put it all together - Create the `GrowLamp`Finally, we create the entire `GrowLamp` entity based on the components we already created.We define subentities in a similar way to all other definitions - as class variables.Additionally, we use influences to connect the ports to each other.
class GrowLamp(crest.Entity): """ - - - - - - - PORTS - - - - - - - - - - """ electricity_in = crest.Input(resource=electricity, value=0) switch_in = crest.Input(resource=switch, value="off") heat_switch_in = crest.Input(resource=switch, value="on") room_temperature_in = crest.Input(resource=fa...
_____no_output_____
MIT
GettingStarted.ipynb
stklik/crestdsl-docker
SimulationSimulation allows us to execute the model and see its evolution.`crestdsl`'s simulator is located in the `simultion` module. In order to use it, we have to import it.
# import the simulator from crestdsl.simulation import Simulator
_____no_output_____
MIT
GettingStarted.ipynb
stklik/crestdsl-docker
After the import, we can use a simulator by initialising it with a system model.In our case, we will explore the `GrowLamp` system that we defined above.
gl = GrowLamp() sim = Simulator(gl)
_____no_output_____
MIT
GettingStarted.ipynb
stklik/crestdsl-docker
StabilisationThe simulator will execute the system's transitions, updates and influences until reaching a fixpoint.This process is referred to as *stabilisation*.Once stable, there are no more transitions can be triggered and all updates/influences/actions have been executed. After stabilisation, all ports have their ...
sim.stabilise() sim.plot()
_____no_output_____
MIT
GettingStarted.ipynb
stklik/crestdsl-docker
Stabilisaiton also has to be called after the modification of input values, such that the new values are used to update any dependent ports.Further, all transitions have to be checked on whether they are enabled and executed if they are.Below, we show the modification of the growlamp and stabilisation.Compare the plot ...
# modify the growlamp instance's inputs directly, the simulator points to that object and will use it gl.electricity_in.value = 500 gl.switch_in.value = "on" sim.stabilise() sim.plot()
_____no_output_____
MIT
GettingStarted.ipynb
stklik/crestdsl-docker
Time advanceEvidently, we also want to simulate the behaviour over time.The simulator's `advance(dt)` method does precisely that, by advancing `dt` time units.Below we advance 500 time steps. The effect is that the global system time is now `t=500` (see the growing lamp's title bar).Additionally, the local variable `o...
sim.advance(500) sim.plot()
_____no_output_____
MIT
GettingStarted.ipynb
stklik/crestdsl-docker
train_features = convert_examples_to_features( train_examples, MAX_SEQ_LENGTH, tokenizer) Create an input function for training. drop_remainder = True for using TPUs.train_input_fn = input_fn_builder( features=train_features, seq_length=MAX_SEQ_LENGTH, is_training=True, drop_remainder=False)
# Compute # train and warmup steps from batch size num_train_steps = int(len(train_examples) / BATCH_SIZE * NUM_TRAIN_EPOCHS) num_warmup_steps = int(num_train_steps * WARMUP_PROPORTION) file_based_convert_examples_to_features( train_examples, MAX_SEQ_LENGTH, tokenizer, train_file) tf.logging.info("***** Run...
INFO:tensorflow:Calling model_fn.
MIT
main/toxic-comment-classification-using-bert.ipynb
anshulwadhawan/FastAI
x_eval = train[100000:] Use the InputExample class from BERT's run_classifier code to create examples from the dataeval_examples = create_examples(x_val)eval_features = convert_examples_to_features( eval_examples, MAX_SEQ_LENGTH, tokenizer) This tells the estimator to run through the entire set.eval_steps = Noneeva...
output_eval_file = os.path.join("../working", "eval_results.txt") with tf.gfile.GFile(output_eval_file, "w") as writer: tf.logging.info("***** Eval results *****") for key in sorted(result.keys()): tf.logging.info(" %s = %s", key, str(result[key])) writer.write("%s = %s\n" % (key, str(result[ke...
Begin predictions! Predicting took time 0:00:00.000069
MIT
main/toxic-comment-classification-using-bert.ipynb
anshulwadhawan/FastAI
x_test = test[125000:140000]x_test = x_test.reset_index(drop=True)predict_examples = create_examples(x_test,False) test_features = convert_examples_to_features(predict_examples, MAX_SEQ_LENGTH, tokenizer) print(f'Beginning Training!')current_time = datetime.now()predict_input_fn = input_fn_builder(features=test_feature...
def create_output(predictions): probabilities = [] for (i, prediction) in enumerate(predictions): preds = prediction["probabilities"] probabilities.append(preds) dff = pd.DataFrame(probabilities) dff.columns = LABEL_COLUMNS return dff output_df = create_output(predictio...
_____no_output_____
MIT
main/toxic-comment-classification-using-bert.ipynb
anshulwadhawan/FastAI
Tests on PDA
import sys sys.path[0:0] = ['../..', '../../3rdparty'] # Append to the beginning of the search path from jove.SystemImports import * from jove.DotBashers import * from jove.Def_md2mc import * from jove.Def_PDA import *
You may use any of these help commands: help(ResetStNum) help(NxtStateStr) You may use any of these help commands: help(md2mc) .. and if you want to dig more, then .. help(default_line_attr) help(length_ok_input_items) help(union_line_attr_list_fld) help(extend_rsltdict) help(form_delta) help(get_machine_components) ...
Unlicense
notebooks/driver/Drive_PDA_Based_Parsing.ipynb
Thanhson89/JA
__IMPORTANT: Must time-bound explore-pda, run-pda, explore-tm, etc so that loops are caught__
repda = md2mc('''PDA !!R -> R R | R + R | R* | ( R ) | 0 | 1 | e I : '', # ; R# -> M M : '', R ; RR -> M M : '', R ; R+R -> M M : '', R ; R* -> M M : '', R ; (R) -> M M : '', R ; 0 -> M M : '', R ; 1 -> M M : '', R ; e -> M M : 0, 0 ; '' -> M M : 1, 1 ; '' -> M M : (, ( ; '' -> M M : ), ) ; ...
*** Exploring wrt STKMAX= 8 ; increase it if needed *** *** Exploring wrt STKMAX = 8 ; increase it if needed *** String 3*2*~3+~~3*~3 accepted by your PDA in 36 ways :-) Here are the ways: Final state ('F', '', '#') Reached as follows: -> ('I', '3*2*~3+~~3*~3', '#') -> ('M', '3*2*~3+~~3*~3', 'E#') -> ('M', '3*2...
Unlicense
notebooks/driver/Drive_PDA_Based_Parsing.ipynb
Thanhson89/JA
This notebook shows the outcome of the experiments I've conducted as well as the code used to read the 'log.txt' file in real time.
%matplotlib inline import matplotlib.pyplot as plt plt.style.use('seaborn-bright') import pandas as pd
_____no_output_____
BSD-2-Clause
Read log and experiment outcome.ipynb
flothesof/RiceCookerExperiments
Real-time plotting of log.txt Let's write a function that reads the current data and plots it:
def read_plot(): "Reads data and plots it." df = pd.read_csv('log.txt', parse_dates=['time']) df = df.set_index(df.pop('time')) df.temperature.plot.line(title='temperature in the rice cooker') df.temperature.rolling(window=60).mean().plot(ls='--', label='averaged temperature') plt.figure(figsize=(10...
_____no_output_____
BSD-2-Clause
Read log and experiment outcome.ipynb
flothesof/RiceCookerExperiments
First experiment Timings:- Start at 12:20:30 (button on).- End at 12:44:00 (button turns itself off) of the experiment.
df = pd.read_csv('log_20160327_v1.txt', parse_dates=['time']) df = df.set_index(df.pop('time')) df.temperature.plot.line(title='2016-03-27 rice cooking experiment 1') df.temperature.rolling(window=60).mean().plot(ls='--', label='averaged temperature') plt.figure(figsize=(10, 6)) df.temperature.plot.line(title='2016-03-...
_____no_output_____
BSD-2-Clause
Read log and experiment outcome.ipynb
flothesof/RiceCookerExperiments
Second experiment I've wrapped the probe in a thin plastic layer this time. I'll also let the temperature stabilize before running the experiment. Starting temperature : 20.6 degrees. I started the log when I pushed the button. Push button pops back at 18:58. End of cooking: now warming instead.
df = pd.read_csv('log_20160327_v2.txt', parse_dates=['time']) df = df.set_index(df.pop('time')) df.temperature.plot.line(title='2016-03-27 rice cooking experiment 2') df.temperature.rolling(window=60).mean().plot(ls='--', label='averaged temperature') plt.figure(figsize=(10, 6)) df.temperature.plot.line(title='2016-03-...
_____no_output_____
BSD-2-Clause
Read log and experiment outcome.ipynb
flothesof/RiceCookerExperiments
esBERTus: evaluation of the models resultsIn this notebook, an evaluation of the results obtained by the two models will be performed. The idea here is not as much to measure a benchmarking metric on the models but to understand the qualitative difference of the models.In order to do so Keyword extractionIn order to ...
from spacy.language import Language import re @Language.component("clean_lemmatize") def clean_lemmatize(doc): text = doc.text text = re.sub(r'\w*\d\w*', r'', text) # remove words containing digits text = re.sub(r'[^a-z\s]', '', text) # remove anything that is not a letter or a space return nlp.make...
Done EU! Done US! Done!
Apache-2.0
04_Evaluation/04_evaluation.ipynb
danieldiezmallo/euBERTus
Keyword extractionDue to the differences in legths and number of texts, it's not possible to use a standard approach to keywords extraction. TF-IDF has been considered, but it takes away most of the very interesting keywords such as "pandemic" or "covid". This is the reason why a hybrid approach between both of the Eu...
from sklearn.feature_extraction.text import CountVectorizer import numpy as np # Read the processed data with open('../data/04_evaluation/full_eu_text_for_tfidf.txt') as f: eu_texts = f.readlines() with open('../data/04_evaluation/full_us_text_for_tfidf.txt') as f: us_texts = f.readlines() # Join the text...
_____no_output_____
Apache-2.0
04_Evaluation/04_evaluation.ipynb
danieldiezmallo/euBERTus
Measure the models performance on masked tokens Extract sentences where the keywords appear
keywords = ['coronavirus', 'covid', 'covid-19', 'virus', 'influenza', 'flu', 'pandemic', 'epidemic', 'outbreak', 'crisis', 'emergency', 'vaccine', 'vaccinated', 'mask', 'quarantine', 'symptoms', 'antibody', 'inmunity', 'distance', 'isolation', 'test', 'positi...
There are 68086 sentences containing keywords
Apache-2.0
04_Evaluation/04_evaluation.ipynb
danieldiezmallo/euBERTus
Measure the probability of outputing the real token in the sentence
# Define a custom function that feeds the three models an example and returns the perplexity def get_masked_token_probaility(sentence:str, keywords:list, models_pipelines:list): # Find the word in the sentence to mask sentence = sentence.lower() keywords = [keyword.lower() for keyword in keywords] targe...
_____no_output_____
Apache-2.0
04_Evaluation/04_evaluation.ipynb
danieldiezmallo/euBERTus
Evaluate the results
import pickle results = pickle.load(open('../data/04_evaluation/sentence_token_prediction.pickle', 'rb')) results[0:5]
_____no_output_____
Apache-2.0
04_Evaluation/04_evaluation.ipynb
danieldiezmallo/euBERTus
Frequences of masked words in the pipeline
from collections import Counter import numpy as np import matplotlib.pyplot as plt words = Counter([result[0] for result in results if result!=None]).most_common(len(keywords)) # most_common also sorts them labels = [word[0] for word in words] values = [word[1] for word in words] indexes = np.arange(len(labels)) fix,...
_____no_output_____
Apache-2.0
04_Evaluation/04_evaluation.ipynb
danieldiezmallo/euBERTus
Average probability of all the masked keywords by model
n_results = len([result for result in results if result!=None]) eu_results = sum([(result[1][0]) for result in results if result!=None]) / n_results us_results = sum([(result[1][1]) for result in results if result!=None]) / n_results base_results = sum([(result[1][2]) for result in results if result!=None]) / n_results...
_____no_output_____
Apache-2.0
04_Evaluation/04_evaluation.ipynb
danieldiezmallo/euBERTus
Get the first predicted token in each sentence, masking
def get_first_predicted_masked_token(sentence:str, eu_pipeline, us_pipeline, base_pipeline): sentence = sentence.lower() model_pipeline_results = [] eu_model_pipeline_results = eu_pipeline(sentence.format(eu_pipeline.tokenizer.mask_token), top_k=1) us_model_pipeline_results = us_pipeline(sentence.format...
Token indices sequence length is longer than the specified maximum sequence length for this model (594 > 512). Running this sequence through the model will result in indexing errors Token indices sequence length is longer than the specified maximum sequence length for this model (514 > 512). Running this sequence throu...
Apache-2.0
04_Evaluation/04_evaluation.ipynb
danieldiezmallo/euBERTus
Evaluate the results
import pickle results = pickle.load(open('../data/04_evaluation/sentence_first_predicted_tokens.pickle', 'rb')) print(len(results)) # Group the results by masked token from itertools import groupby from operator import itemgetter from collections import Counter import numpy as np import matplotlib.pyplot as plt n_words...
_____no_output_____
Apache-2.0
04_Evaluation/04_evaluation.ipynb
danieldiezmallo/euBERTus
Qualitative evaluation of masked token predictionThe objective of this section is not to compare the score obtained by all the models that are being used, but to compare what are the qualitative outputs of these models. This means that the comparison is going to be done manually, by inputing phrases that contain words...
def get_masked_token(sentence:str, eu_pipeline, us_pipeline, base_pipeline, n_results=1): sentence = sentence.lower() model_pipeline_results = [] eu_prediction = eu_pipeline(sentence.format(eu_pipeline.tokenizer.mask_token), top_k =n_results)[0] us_prediction = us_pipeline(sentence.format(us_pipeline.to...
_____no_output_____
Apache-2.0
04_Evaluation/04_evaluation.ipynb
danieldiezmallo/euBERTus
European institutions sentences
# Source https://ec.europa.eu/info/live-work-travel-eu/coronavirus-response_en # Masked token: coronavirus sentence = """The European Commission is coordinating a common European response to the {} outbreak. We are taking resolute action to reinforce our public health sectors and mitigate the socio-economic impact in ...
EUROPEAN MODEL -------> economy the eu ’ s long - term budget, coupled with nextgenerationeu, the temporary instrument designed to boost the ECONOMY, will be the largest stimulus package ever financed in europe. a total of €1. 8 trillion will help rebuild a post - covid - 19 europe. it will be a greener, more dig...
Apache-2.0
04_Evaluation/04_evaluation.ipynb
danieldiezmallo/euBERTus
US Government sentences
# Source https://www.usa.gov/covid-unemployment-benefits # Masked token: provide sentence = 'The federal government has allowed states to change their laws to {} COVID-19 unemployment benefits for people whose jobs have been affected by the coronavirus pandemic.' get_masked_token(sentence, eu_model_pipeline, us_model_p...
EUROPEAN MODEL -------> crisis with the covid - 19 CRISIS continuing to evolve, we continue to provide relevant resources to help our grantees, partners, and stakeholders support children, families, and communities in need during this challenging time. UNITED STATES MODEL -------> pandemic with the covid - 19 PA...
Apache-2.0
04_Evaluation/04_evaluation.ipynb
danieldiezmallo/euBERTus
**Introduction to Python**Prof. Dr. Jan Kirenz Hochschule der Medien Stuttgart Table of Contents1&nbsp;&nbsp;Import CSV2&nbsp;&nbsp;Save CSV
# import module import pandas as pd
_____no_output_____
MIT
1_pandas_import_save_csv.ipynb
kirenz/forst_steps_in_python
* **Pandas** provides a DataFrame object along with a powerful set of methods to manipulate, filter, group, and transform data. A **DataFrame** represents a rectangular table of data and contains an ordered collection of columns,each of which can be a different value type (numeric, string, boolean, etc.). The DataFra...
# Import data from GitHub df = pd.read_csv("https://raw.githubusercontent.com/kirenz/datasets/master/wage.csv")
_____no_output_____
MIT
1_pandas_import_save_csv.ipynb
kirenz/forst_steps_in_python
If you would like to import a local CSV-file from machine, you need to change the path accordingly:
# if you have a Mac, use this code df = pd.read_csv('/Users/.../wage.csv') # if you have Windows, use this code df = pd.read_csv('C://...//wage.csv')
_____no_output_____
MIT
1_pandas_import_save_csv.ipynb
kirenz/forst_steps_in_python
Save CSV Save df as new csv-file
# if you have a Mac, use this code df.to_csv('/Users/.../wage_new.csv') # if you have Windows, use this code df.to_csv('C://...//wage_new.csv')
_____no_output_____
MIT
1_pandas_import_save_csv.ipynb
kirenz/forst_steps_in_python
对象和类- 一个学生,一张桌子,一个圆都是对象- 对象是类的一个实例,你可以创建多个对象,创建类的一个实例过程被称为实例化,- 在Python中对象就是实例,而实例就是对象 定义类class ClassName: do something - class 类的表示与def 一样- 类名最好使用驼峰式- 在Python2中类是需要继承基类object的,在Python中默认继承,可写可不写- 可以将普通代码理解为皮肤,而函数可以理解为内衣,那么类可以理解为外套
# 类必须初始化,是用self,初始化自身. # 类里面所有的函数中的第一个变量不再是参数,而是一个印记. # 在类中,如果有参数需要多次使用,那么就可以将其设置为共享参数 class Joker: def __init__(self,num1,num2): print('我初始化了') # 参数共享 self.num1 = num1 self.num2 = num2 print(self.num1,self.num2) def SUM(self,name): print(name) return self...
_____no_output_____
Apache-2.0
7.23.ipynb
wsq7777/Python
定义一个不含初始化__init__的简单类class ClassName: joker = “Home” def func(): print('Worker') - 尽量少使用 定义一个标准类- __init__ 代表初始化,可以初始化任何动作- 此时类调用要使用(),其中()可以理解为开始初始化- 初始化内的元素,类中其他的函数可以共享![](../Photo/85.png) - Circle 和 className_ 的第一个区别有 __init__ 这个函数- 。。。。 第二个区别,类中的每一个函数都有self的这个“参数” 何为self?- self 是指向对象本身的参数- ...
class Joker2: """ Implement Login Class. """ def __init__(self): """ Initialization class Arguments: --------- name: xxx None. Returns: -------- None. """ self.account = '123' self.password = '123...
请输入账号:>>123 请输入密码:>>1 验证码是: 123 请输入验证码:>>1 请输入验证码:>>1 请输入验证码:>>123 Failed
Apache-2.0
7.23.ipynb
wsq7777/Python
类的继承- 类的单继承- 类的多继承- 继承标识> class SonClass(FatherClass): def __init__(self): FatherClass.__init__(self)
a = 100 a = 1000 a
_____no_output_____
Apache-2.0
7.23.ipynb
wsq7777/Python
私有变量,不可继承,不可在外部调用,但是可以在内部使用.
class A: def __init__(self): self.__a = 'a' def a_(self): print('aa') print(self.__a) def b(): a() def a(): print('hahah') b()
hahah
Apache-2.0
7.23.ipynb
wsq7777/Python
_ _ -- + = / \ { } [] ! ~ !@ $ % ^ & * ( ) …… 私有数据域(私有变量,或者私有函数)- 在Python中 变量名或者函数名使用双下划线代表私有 \__Joker, def \__Joker():- 私有数据域不可继承- 私有数据域强制继承 \__dir__() ![](../Photo/87.png) EP:![](../Photo/88.png)![](../Photo/89.png)![](../Photo/90.png) 类的其他- 类的封装 - 实际上就是将一类功能放在一起,方便未来进行管理- 类的继承(上面已经讲过)- 类的多态 - 包括装饰器:...
class Rectangle(): def __init__(self,width,height): self.width=4 self.height=40 def getArea(self,width,height): self.area=width*height print(self.area) def getPerimeter(self,width,height): self.perimeter=(width+height)*2 print(self.perimeter) if __name__=='_...
160 88 124.95000000000002 78.4
Apache-2.0
7.23.ipynb
wsq7777/Python
- 2![](../Photo/92.png)
class Account(): def __init__(self): self.id = 0 self.__balance = 100 self.__annuallnterestRate=0 def set_(self,id,balance,annuallnterestRate): self.id = id self.__balance = balance self.__annuallnterestRate=annuallnterestRate def getid(self): return s...
请输入账户ID:1122 请输入账户金额:20000 年利率为:4.5 取钱金额为:2500 存钱金额为:3000 账户ID:1122 剩余金额:20500.00 月利率:0.375 月利息:76.88
Apache-2.0
7.23.ipynb
wsq7777/Python
- 3![](../Photo/93.png)
class Fan(): def __init__(self): self.slow=1 self.medium=2 self.fast=3 self.__speed=1 self.__on=False self.__radius=5 self.__color='blue' def set_(self,speed,on,radius,color): self.__speed=speed self.__on=on self.__radius=radius ...
风扇的速度为(1:slow,2:medium,3:fast):3 风扇的半径为:10 风扇的颜色是:yellow 风扇是否打开(True or False):True 风扇的速度为(1:slow,2:medium,3:fast):2 风扇的半径为:5 风扇的颜色是:blue 风扇是否打开(True or False):Flase 1号风扇的速度(speed)为: 3 颜色是(color): yellow 风扇的半径为(radius): 10.0 风扇是: True 2号风扇的速度(speed)为: 2 颜色是(color): blue 风扇的半径为(radius): 5.0 风扇是: Flase
Apache-2.0
7.23.ipynb
wsq7777/Python
- 4![](../Photo/94.png)![](../Photo/95.png)
import math class RegularPolygon: def __init__(self,n,side,x,y): self.n=n self.side=side self.x=x self.y=y def getArea(self): return (self.n*self.side**2)/4*math.tan(3.14/self.n) def getPerimeter(self): return self.n*self.side if __name__ == "__main__": n,...
n,side,x,y:>>10,4,5.6,7.8 10.0 4.0 5.6 7.8 12.989745035699281 40.0
Apache-2.0
7.23.ipynb
wsq7777/Python
- 5![](../Photo/96.png)
class LinearEquation(object): a = 0 b = 0 c = 0 d = 0 e = 0 f = 0 def __init__(self,a,b,c,d,e,f): self.a = a self.b = b self.c = c self.d = d self.e = e self.f = f def getA(self): return self.a def getB(self): retur...
请输入abcdef的值1,2,3,4,5,6 -4.0 4.5
Apache-2.0
7.23.ipynb
wsq7777/Python
- 6![](../Photo/97.png)
class LinearEquation: def zuobiao(self): import math x1,y1,x2,y2=map(float,input().split(',')) x3,y3,x4,y4=map(float,input().split(',')) u1=(x4-x3)*(y1-y3)-(x1-x3)*(y4-y3) v1=(x4-x3)*(y2-y3)-(x2-x3)*(y4-y3) u=math.fabs(u1) v=math.fabs(v1) x5=(x1...
2.0,2.0,0,0 0,2.0,2.0,0 1.0 1.0
Apache-2.0
7.23.ipynb
wsq7777/Python
- 7![](../Photo/98.png)
class LinearEquation(object): a = 0 b = 0 c = 0 d = 0 e = 0 f = 0 def __init__(self,a,b,c,d,e,f): self.a = a self.b = b self.c = c self.d = d self.e = e self.f = f def getA(self): return self.a def getB(self): retur...
请输入abcdef的值4,8,9,3,5,6 0.55 0.35
Apache-2.0
7.23.ipynb
wsq7777/Python
Transfer Learning Template
%load_ext autoreload %autoreload 2 %matplotlib inline import os, json, sys, time, random import numpy as np import torch from torch.optim import Adam from easydict import EasyDict import matplotlib.pyplot as plt from steves_models.steves_ptn import Steves_Prototypical_Network from steves_utils.lazy_iterable_wr...
_____no_output_____
MIT
experiments/tl_1v2/wisig-oracle.run1.framed/trials/28/trial.ipynb
stevester94/csc500-notebooks
Allowed ParametersThese are allowed parameters, not defaultsEach of these values need to be present in the injected parameters (the notebook will raise an exception if they are not present)Papermill uses the cell tag "parameters" to inject the real parameters below this cell.Enable tags to see what I mean
required_parameters = { "experiment_name", "lr", "device", "seed", "dataset_seed", "n_shot", "n_query", "n_way", "train_k_factor", "val_k_factor", "test_k_factor", "n_epoch", "patience", "criteria_for_best", "x_net", "datasets", "torch_default_dtype", ...
_____no_output_____
MIT
experiments/tl_1v2/wisig-oracle.run1.framed/trials/28/trial.ipynb
stevester94/csc500-notebooks
Week 4 T - testing and Inferential Statistics Most people turn to IMB SPSS for T-testings, but this programme is very expensive, very old and not really necessary if you have access to Python tools. Very focused on click and point and is probably more useful to people without a programming background. Libraries
import matplotlib.pyplot as plt import numpy as np import seaborn as sns import pandas as pd import scipy.stats as ss import statsmodels.stats.weightstats as sm_ttest
_____no_output_____
Apache-2.0
4_Ttests.ipynb
MarionMcG/machine_learning_statistics
Reading * [Independent t-test using SPSS Statistics on laerd.com](https://statistics.laerd.com/spss-tutorials/independent-t-test-using-spss-statistics.php)* [ScipyStats documentation on ttest_ind](https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.ttest_ind.html)* [StatsModels documentation on ttest_ind...
#Generating random data for the heights of 30 males in my sample m = np.random.normal(1.8, 0.1, 30) #Generating random data for the heights of 30 females in my sample f = np.random.normal(1.6, 0.1, 30) ss.stats.ttest_ind(m, f)
_____no_output_____
Apache-2.0
4_Ttests.ipynb
MarionMcG/machine_learning_statistics
The null hypothesis (H0) claims that the average male height in the population is equal to the average female height in the population. Using my sample, I can infer if the H0 should be accepted or rejected. Based on my very small pvalue, we can reject the null hypothesis. The pvalue refers to the probability of finding...
np.mean(m) np.mean(f)
_____no_output_____
Apache-2.0
4_Ttests.ipynb
MarionMcG/machine_learning_statistics
Statsmodels
sm_ttest.ttest_ind(m, f)
_____no_output_____
Apache-2.0
4_Ttests.ipynb
MarionMcG/machine_learning_statistics
Graphical Analysis
#Seaborn displot to show means plt.figure() sns.distplot(m, label = 'male') sns.distplot(f, label = 'female') plt.legend(); df = pd.DataFrame({'male': m, 'female': f}) df
_____no_output_____
Apache-2.0
4_Ttests.ipynb
MarionMcG/machine_learning_statistics
It's typically not a good idea to list values side by side. It implies a relationship between the data and can lead to problems if we don't have the same sample size of males as females.
a = ['male'] * 30 b = ['female'] * 30 gender = a+b # I can't add arrays for males and females in the same way # As they are numpy arrays height = np.concatenate([m, f]) df = pd.DataFrame({'Gender': gender, 'Height': height}) df #Taking out just the male heights df[df['Gender'] == 'male']['Height'] df[df['Gender'] == '...
_____no_output_____
Apache-2.0
4_Ttests.ipynb
MarionMcG/machine_learning_statistics
Модель предсказания ключевых фраз
import numpy as np import pandas as pd pd.set_option('display.max_rows', 100) pd.set_option('display.max_columns', 100) import joblib import warnings warnings.filterwarnings('ignore') %run ThePropertyPhrases.py ThePropertyPhrasesGenerator
_____no_output_____
MIT
src/05_simple_demonstration.ipynb
cherninkiy/made-ml-hw4
Исходные данные
train = pd.read_csv('train875.csv') train.head(2) reviews = pd.read_csv('reviews875.csv') reviews.head(2)
_____no_output_____
MIT
src/05_simple_demonstration.ipynb
cherninkiy/made-ml-hw4
Вспомогательные функции
def get_from_train_by_index(i): return train[train.index == i].to_dict(orient='records')[0] def get_from_train_by_id(idx): return train[train.id == idx].to_dict(orient='records')[0] def get_reviews_by_index(i): idx = train[train.index == i].id.values[0] return reviews.loc[reviews.listing_id == idx, :]...
_____no_output_____
MIT
src/05_simple_demonstration.ipynb
cherninkiy/made-ml-hw4
Тест модели
phrases_generator = ThePropertyPhrasesGenerator() for rec_index in [10, 16, 18]: d = get_from_train_by_index(rec_index) phrases = phrases_generator.generate_key_phrases(d) phrases = phrases.reset_index() if 'index' in phrases.columns: phrases = phrases.drop(columns=['index'], axis=1) comme...
_____no_output_____
MIT
src/05_simple_demonstration.ipynb
cherninkiy/made-ml-hw4
ConnectUse the `%connect` magic to find your Ascent instance and connect to it.
%connect
_____no_output_____
BSD-3-Clause
src/ascent/python/ascent_jupyter_bridge/notebooks/demo - trackball widget.ipynb
goodbadwolf/ascent
Specify ActionsSpecify your actions using a **yaml** or **json** string or any other method permitted by the Ascent Python API.
yaml = """ - action: "add_scenes" scenes: s1: plots: p1: type: "volume" field: "energy" color_table: name: "cool to warm" control_points: - type: "alpha" position: 0 alpha: .3 ...
_____no_output_____
BSD-3-Clause
src/ascent/python/ascent_jupyter_bridge/notebooks/demo - trackball widget.ipynb
goodbadwolf/ascent
Execute ActionsUse the builtin `jupyter_ascent` ascent instance to execute your actions for compatability with widgets (below) or create your own ascent instance. Note that once you are connected you can use tab completion to find variables and functions in your namespace (e.g. `jupyter_ascent`, `display_images`)
jupyter_ascent.execute(actions)
_____no_output_____
BSD-3-Clause
src/ascent/python/ascent_jupyter_bridge/notebooks/demo - trackball widget.ipynb
goodbadwolf/ascent
Display ImagesDisplay all they images you've generated with the builtin `display_images` function.
# Get info about the generated images from Ascent info = conduit.Node() jupyter_ascent.info(info) # Display the images specified in info display_images(info)
_____no_output_____
BSD-3-Clause
src/ascent/python/ascent_jupyter_bridge/notebooks/demo - trackball widget.ipynb
goodbadwolf/ascent
The Trackball WidgetUse builtin Jupyter widgets to interact with your images. The trackball widget lets you rotate your image by dragging the control cube. You can also move with around with WASD and the provided buttons. Finally you can advance the simulation to see the next image.
%trackball
_____no_output_____
BSD-3-Clause
src/ascent/python/ascent_jupyter_bridge/notebooks/demo - trackball widget.ipynb
goodbadwolf/ascent
[LINK](https://www.tutorialspoint.com/python/python_variable_types.htm) Variable Types---Variables are nothing but reserved memory locations to store values. This means that when you create a variable you reserve some space in memory.Based on the data type of a variable, the interpreter allocates memory and decides wh...
_____no_output_____
Apache-2.0
Python_Course/Variable_Types.ipynb
gu-raime/dental.informatics.org
Copyright (c) Microsoft Corporation. All rights reserved.Licensed under the MIT License. Explore Duplicate Question MatchesUse this dashboard to explore the relationship between duplicate and original questions. SetupThis section loads needed packages, and defines useful functions.
from __future__ import print_function import math import ipywidgets as widgets import pandas as pd import requests from azureml.core.webservice import AksWebservice from azureml.core.workspace import Workspace from dotenv import get_key, find_dotenv from utilities import read_questions, text_to_json, get_auth env_pa...
_____no_output_____
MIT
architectures/Python-ML-RealTimeServing/{{cookiecutter.project_name}}/aks/07_RealTimeScoring.ipynb
dciborow/AIArchitecturesAndPractices