{"id":1603,"date":"2022-10-28T09:21:33","date_gmt":"2022-10-28T16:21:33","guid":{"rendered":"https:\/\/gantovnik.com\/bio-tips\/?p=1603"},"modified":"2022-10-29T04:14:23","modified_gmt":"2022-10-29T11:14:23","slug":"210-parametric-curve-in-3d-2-2-2-2-2-2-2-2-2-2-2-2-2-3-3-2-2-3-2-2-4-2-2","status":"publish","type":"post","link":"https:\/\/gantovnik.com\/bio-tips\/2022\/10\/210-parametric-curve-in-3d-2-2-2-2-2-2-2-2-2-2-2-2-2-3-3-2-2-3-2-2-4-2-2\/","title":{"rendered":"#307 Categorize support issues using multiclass classification with ML.NET using C#"},"content":{"rendered":"<p>Data file: Download the and place to Data folder two files: issues_train.tsv and the issues_test.tsv<\/p>\n<p>GitHubIssueData.cs<\/p>\n<pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\r\n\/\/ &lt;SnippetAddUsings&gt;\r\nusing Microsoft.ML.Data;\r\n\/\/ &lt;\/SnippetAddUsings&gt;\r\n\r\nnamespace GitHubIssueClassification\r\n{\r\n    \/\/ &lt;SnippetDeclareTypes&gt;\r\n    public class GitHubIssue\r\n    {\r\n        &#x5B;LoadColumn(0)]\r\n        public string ID { get; set; }\r\n        &#x5B;LoadColumn(1)]\r\n        public string Area { get; set; }\r\n        &#x5B;LoadColumn(2)]\r\n        public string Title { get; set; }\r\n        &#x5B;LoadColumn(3)]\r\n        public string Description { get; set; }\r\n    }\r\n\r\n    public class IssuePrediction\r\n    {\r\n        &#x5B;ColumnName(&quot;PredictedLabel&quot;)]\r\n        public string Area;\r\n    }\r\n    \/\/ &lt;\/SnippetDeclareTypes&gt;\r\n}\r\n<\/pre>\n<p>Program.cs<\/p>\n<pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\r\n\/\/ &lt;SnippetAddUsings&gt;\r\nusing System;\r\nusing System.IO;\r\nusing System.Linq;\r\nusing Microsoft.ML;\r\n\/\/ &lt;\/SnippetAddUsings&gt;\r\n\r\nnamespace GitHubIssueClassification\r\n{\r\n    class Program\r\n    {\r\n        \/\/ &lt;SnippetDeclareGlobalVariables&gt;\r\n        private static string _appPath =&gt; Path.GetDirectoryName(Environment.GetCommandLineArgs()&#x5B;0]);\r\n        private static string _trainDataPath =&gt; Path.Combine(_appPath, &quot;..&quot;, &quot;..&quot;, &quot;..&quot;, &quot;Data&quot;, &quot;issues_train.tsv&quot;);\r\n        private static string _testDataPath =&gt; Path.Combine(_appPath, &quot;..&quot;, &quot;..&quot;, &quot;..&quot;, &quot;Data&quot;, &quot;issues_test.tsv&quot;);\r\n        private static string _modelPath =&gt; Path.Combine(_appPath, &quot;..&quot;, &quot;..&quot;, &quot;..&quot;, &quot;Models&quot;, &quot;model.zip&quot;);\r\n\r\n        private static MLContext _mlContext;\r\n        private static PredictionEngine&lt;GitHubIssue, IssuePrediction&gt; _predEngine;\r\n        private static ITransformer _trainedModel;\r\n        static IDataView _trainingDataView;\r\n        \/\/ &lt;\/SnippetDeclareGlobalVariables&gt;\r\n        static void Main(string&#x5B;] args)\r\n        {\r\n            \/\/ Create MLContext to be shared across the model creation workflow objects\r\n            \/\/ Set a random seed for repeatable\/deterministic results across multiple trainings.\r\n            \/\/ &lt;SnippetCreateMLContext&gt;\r\n            _mlContext = new MLContext(seed: 0);\r\n            \/\/ &lt;\/SnippetCreateMLContext&gt;\r\n\r\n            \/\/ STEP 1: Common data loading configuration\r\n            \/\/ CreateTextReader&lt;GitHubIssue&gt;(hasHeader: true) - Creates a TextLoader by inferencing the dataset schema from the GitHubIssue data model type.\r\n            \/\/ .Read(_trainDataPath) - Loads the training text file into an IDataView (_trainingDataView) and maps from input columns to IDataView columns.\r\n            Console.WriteLine($&quot;=============== Loading Dataset  ===============&quot;);\r\n\r\n            \/\/ &lt;SnippetLoadTrainData&gt;\r\n            _trainingDataView = _mlContext.Data.LoadFromTextFile&lt;GitHubIssue&gt;(_trainDataPath, hasHeader: true);\r\n            \/\/ &lt;\/SnippetLoadTrainData&gt;\r\n\r\n            Console.WriteLine($&quot;=============== Finished Loading Dataset  ===============&quot;);\r\n\r\n            \/\/ &lt;SnippetSplitData&gt;\r\n            \/\/   var (trainData, testData) = _mlContext.MulticlassClassification.TrainTestSplit(_trainingDataView, testFraction: 0.1);\r\n            \/\/ &lt;\/SnippetSplitData&gt;\r\n\r\n            \/\/ &lt;SnippetCallProcessData&gt;\r\n            var pipeline = ProcessData();\r\n            \/\/ &lt;\/SnippetCallProcessData&gt;\r\n\r\n            \/\/ &lt;SnippetCallBuildAndTrainModel&gt;\r\n            var trainingPipeline = BuildAndTrainModel(_trainingDataView, pipeline);\r\n            \/\/ &lt;\/SnippetCallBuildAndTrainModel&gt;\r\n\r\n            \/\/ &lt;SnippetCallEvaluate&gt;\r\n            Evaluate(_trainingDataView.Schema);\r\n            \/\/ &lt;\/SnippetCallEvaluate&gt;\r\n\r\n            \/\/ &lt;SnippetCallPredictIssue&gt;\r\n            PredictIssue();\r\n            \/\/ &lt;\/SnippetCallPredictIssue&gt;\r\n            Console.WriteLine(&quot;Press enter to close...&quot;);\r\n            Console.ReadLine();\r\n        }\r\n\r\n        public static IEstimator&lt;ITransformer&gt; ProcessData()\r\n        {\r\n            Console.WriteLine($&quot;=============== Processing Data ===============&quot;);\r\n            \/\/ STEP 2: Common data process configuration with pipeline data transformations\r\n            \/\/ &lt;SnippetMapValueToKey&gt;\r\n            var pipeline = _mlContext.Transforms.Conversion.MapValueToKey(inputColumnName: &quot;Area&quot;, outputColumnName: &quot;Label&quot;)\r\n                            \/\/ &lt;\/SnippetMapValueToKey&gt;\r\n                            \/\/ &lt;SnippetFeaturizeText&gt;\r\n                            .Append(_mlContext.Transforms.Text.FeaturizeText(inputColumnName: &quot;Title&quot;, outputColumnName: &quot;TitleFeaturized&quot;))\r\n                            .Append(_mlContext.Transforms.Text.FeaturizeText(inputColumnName: &quot;Description&quot;, outputColumnName: &quot;DescriptionFeaturized&quot;))\r\n                            \/\/ &lt;\/SnippetFeaturizeText&gt;\r\n                            \/\/ &lt;SnippetConcatenate&gt;\r\n                            .Append(_mlContext.Transforms.Concatenate(&quot;Features&quot;, &quot;TitleFeaturized&quot;, &quot;DescriptionFeaturized&quot;))\r\n                            \/\/ &lt;\/SnippetConcatenate&gt;\r\n                            \/\/Sample Caching the DataView so estimators iterating over the data multiple times, instead of always reading from file, using the cache might get better performance.\r\n                            \/\/ &lt;SnippetAppendCache&gt;\r\n                            .AppendCacheCheckpoint(_mlContext);\r\n            \/\/ &lt;\/SnippetAppendCache&gt;\r\n\r\n            Console.WriteLine($&quot;=============== Finished Processing Data ===============&quot;);\r\n\r\n            \/\/ &lt;SnippetReturnPipeline&gt;\r\n            return pipeline;\r\n            \/\/ &lt;\/SnippetReturnPipeline&gt;\r\n        }\r\n\r\n        public static IEstimator&lt;ITransformer&gt; BuildAndTrainModel(IDataView trainingDataView, IEstimator&lt;ITransformer&gt; pipeline)\r\n        {\r\n            \/\/ STEP 3: Create the training algorithm\/trainer\r\n            \/\/ Use the multi-class SDCA algorithm to predict the label using features.\r\n            \/\/Set the trainer\/algorithm and map label to value (original readable state)\r\n            \/\/ &lt;SnippetAddTrainer&gt;\r\n            var trainingPipeline = pipeline.Append(_mlContext.MulticlassClassification.Trainers.SdcaMaximumEntropy(&quot;Label&quot;, &quot;Features&quot;))\r\n                    .Append(_mlContext.Transforms.Conversion.MapKeyToValue(&quot;PredictedLabel&quot;));\r\n            \/\/ &lt;\/SnippetAddTrainer&gt;\r\n\r\n            \/\/ STEP 4: Train the model fitting to the DataSet\r\n            Console.WriteLine($&quot;=============== Training the model  ===============&quot;);\r\n\r\n            \/\/ &lt;SnippetTrainModel&gt;\r\n            _trainedModel = trainingPipeline.Fit(trainingDataView);\r\n            \/\/ &lt;\/SnippetTrainModel&gt;\r\n            Console.WriteLine($&quot;=============== Finished Training the model Ending time: {DateTime.Now.ToString()} ===============&quot;);\r\n\r\n            \/\/ (OPTIONAL) Try\/test a single prediction with the &quot;just-trained model&quot; (Before saving the model)\r\n            Console.WriteLine($&quot;=============== Single Prediction just-trained-model ===============&quot;);\r\n\r\n            \/\/ Create prediction engine related to the loaded trained model\r\n            \/\/ &lt;SnippetCreatePredictionEngine1&gt;\r\n            _predEngine = _mlContext.Model.CreatePredictionEngine&lt;GitHubIssue, IssuePrediction&gt;(_trainedModel);\r\n            \/\/ &lt;\/SnippetCreatePredictionEngine1&gt;\r\n            \/\/ &lt;SnippetCreateTestIssue1&gt;\r\n            GitHubIssue issue = new GitHubIssue()\r\n            {\r\n                Title = &quot;WebSockets communication is slow in my machine&quot;,\r\n                Description = &quot;The WebSockets communication used under the covers by SignalR looks like is going slow in my development machine..&quot;\r\n            };\r\n            \/\/ &lt;\/SnippetCreateTestIssue1&gt;\r\n\r\n            \/\/ &lt;SnippetPredict&gt;\r\n            var prediction = _predEngine.Predict(issue);\r\n            \/\/ &lt;\/SnippetPredict&gt;\r\n\r\n            \/\/ &lt;SnippetOutputPrediction&gt;\r\n            Console.WriteLine($&quot;=============== Single Prediction just-trained-model - Result: {prediction.Area} ===============&quot;);\r\n            \/\/ &lt;\/SnippetOutputPrediction&gt;\r\n\r\n            \/\/ &lt;SnippetReturnModel&gt;\r\n            return trainingPipeline;\r\n            \/\/ &lt;\/SnippetReturnModel&gt;\r\n        }\r\n\r\n        public static void Evaluate(DataViewSchema trainingDataViewSchema)\r\n        {\r\n            \/\/ STEP 5:  Evaluate the model in order to get the model's accuracy metrics\r\n            Console.WriteLine($&quot;=============== Evaluating to get model's accuracy metrics - Starting time: {DateTime.Now.ToString()} ===============&quot;);\r\n\r\n            \/\/Load the test dataset into the IDataView\r\n            \/\/ &lt;SnippetLoadTestDataset&gt;\r\n            var testDataView = _mlContext.Data.LoadFromTextFile&lt;GitHubIssue&gt;(_testDataPath, hasHeader: true);\r\n            \/\/ &lt;\/SnippetLoadTestDataset&gt;\r\n\r\n            \/\/Evaluate the model on a test dataset and calculate metrics of the model on the test data.\r\n            \/\/ &lt;SnippetEvaluate&gt;\r\n            var testMetrics = _mlContext.MulticlassClassification.Evaluate(_trainedModel.Transform(testDataView));\r\n            \/\/ &lt;\/SnippetEvaluate&gt;\r\n\r\n            Console.WriteLine($&quot;=============== Evaluating to get model's accuracy metrics - Ending time: {DateTime.Now.ToString()} ===============&quot;);\r\n            \/\/ &lt;SnippetDisplayMetrics&gt;\r\n            Console.WriteLine($&quot;*************************************************************************************************************&quot;);\r\n            Console.WriteLine($&quot;*       Metrics for Multi-class Classification model - Test Data     &quot;);\r\n            Console.WriteLine($&quot;*------------------------------------------------------------------------------------------------------------&quot;);\r\n            Console.WriteLine($&quot;*       MicroAccuracy:    {testMetrics.MicroAccuracy:0.###}&quot;);\r\n            Console.WriteLine($&quot;*       MacroAccuracy:    {testMetrics.MacroAccuracy:0.###}&quot;);\r\n            Console.WriteLine($&quot;*       LogLoss:          {testMetrics.LogLoss:#.###}&quot;);\r\n            Console.WriteLine($&quot;*       LogLossReduction: {testMetrics.LogLossReduction:#.###}&quot;);\r\n            Console.WriteLine($&quot;*************************************************************************************************************&quot;);\r\n            \/\/ &lt;\/SnippetDisplayMetrics&gt;\r\n\r\n            \/\/ Save the new model to .ZIP file\r\n            \/\/ &lt;SnippetCallSaveModel&gt;\r\n            SaveModelAsFile(_mlContext, trainingDataViewSchema, _trainedModel);\r\n            \/\/ &lt;\/SnippetCallSaveModel&gt;\r\n        }\r\n\r\n        public static void PredictIssue()\r\n        {\r\n            \/\/ &lt;SnippetLoadModel&gt;\r\n            ITransformer loadedModel = _mlContext.Model.Load(_modelPath, out var modelInputSchema);\r\n            \/\/ &lt;\/SnippetLoadModel&gt;\r\n\r\n            \/\/ &lt;SnippetAddTestIssue&gt;\r\n            GitHubIssue singleIssue = new GitHubIssue() { Title = &quot;Entity Framework crashes&quot;, Description = &quot;When connecting to the database, EF is crashing&quot; };\r\n            \/\/ &lt;\/SnippetAddTestIssue&gt;\r\n\r\n            \/\/Predict label for single hard-coded issue\r\n            \/\/ &lt;SnippetCreatePredictionEngine&gt;\r\n            _predEngine = _mlContext.Model.CreatePredictionEngine&lt;GitHubIssue, IssuePrediction&gt;(loadedModel);\r\n            \/\/ &lt;\/SnippetCreatePredictionEngine&gt;\r\n\r\n            \/\/ &lt;SnippetPredictIssue&gt;\r\n            var prediction = _predEngine.Predict(singleIssue);\r\n            \/\/ &lt;\/SnippetPredictIssue&gt;\r\n\r\n            \/\/ &lt;SnippetDisplayResults&gt;\r\n            Console.WriteLine($&quot;=============== Single Prediction - Result: {prediction.Area} ===============&quot;);\r\n            \/\/ &lt;\/SnippetDisplayResults&gt;\r\n        }\r\n\r\n        private static void SaveModelAsFile(MLContext mlContext, DataViewSchema trainingDataViewSchema, ITransformer model)\r\n        {\r\n            \/\/ &lt;SnippetSaveModel&gt;\r\n            mlContext.Model.Save(model, trainingDataViewSchema, _modelPath);\r\n            \/\/ &lt;\/SnippetSaveModel&gt;\r\n\r\n            Console.WriteLine(&quot;The model is saved to {0}&quot;, _modelPath);\r\n        }\r\n    }\r\n}\r\n\r\n<\/pre>\n<p>Output:<\/p>\n<pre class=\"brush: python; title: ; notranslate\" title=\"\">\r\n*       Metrics for Multi-class Classification model - Test Data\r\n*------------------------------------------------------------------------------------------------------------\r\n*       MicroAccuracy:    0.739\r\n*       MacroAccuracy:    0.674\r\n*       LogLoss:          .907\r\n*       LogLossReduction: .648\r\n<\/pre>\n<p><a href=\"https:\/\/github.com\/gantovnik\/wordpress_examples\/tree\/main\/ex307\" rel=\"noopener\" target=\"_blank\">https:\/\/github.com\/gantovnik\/wordpress_examples\/tree\/main\/ex307<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Data file: Download the and place to Data folder two files: issues_train.tsv and the issues_test.tsv GitHubIssueData.cs \/\/ &lt;SnippetAddUsings&gt; using Microsoft.ML.Data; \/\/ &lt;\/SnippetAddUsings&gt; namespace GitHubIssueClassification { \/\/ &lt;SnippetDeclareTypes&gt; public class GitHubIssue { &#x5B;LoadColumn(0)] public string ID { get; set; } &#x5B;LoadColumn(1)] public string Area { get; set; } &#x5B;LoadColumn(2)] public string Title { get; set; } [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"nf_dc_page":"","_et_pb_use_builder":"","_et_pb_old_content":"","_et_gb_content_width":"","_lmt_disableupdate":"yes","_lmt_disable":"","jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[50],"tags":[],"class_list":["post-1603","post","type-post","status-publish","format-standard","hentry","category-c"],"modified_by":"gantovnik","jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p8bH0k-pR","jetpack_likes_enabled":true,"jetpack-related-posts":[{"id":1596,"url":"https:\/\/gantovnik.com\/bio-tips\/2022\/10\/210-parametric-curve-in-3d-2-2-2-2-2-2-2-2-2-2-2-2-2-3-3-2-2-3-2-2-4\/","url_meta":{"origin":1603,"position":0},"title":"#305 Line plot using C#","author":"gantovnik","date":"2022-10-26","format":false,"excerpt":"Temperature.cs [code language=\"python\"] using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace WindowsFormsApp1 { public class Temperature { public string Location { get; set; } public decimal M1 { get; set; } public decimal M2 { get; set; } public decimal M3 { get; set; } public decimal\u2026","rel":"","context":"In &quot;C#&quot;","block_context":{"text":"C#","link":"https:\/\/gantovnik.com\/bio-tips\/category\/c\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2022\/10\/2022-10-26_041420-300x276.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":1611,"url":"https:\/\/gantovnik.com\/bio-tips\/2022\/10\/210-parametric-curve-in-3d-2-2-2-2-2-2-2-2-2-2-2-2-2-3-3-2-2-3-2-2-4-2-2-2\/","url_meta":{"origin":1603,"position":1},"title":"#308 Predict prices using regression with ML.NET using C#","author":"gantovnik","date":"2022-10-30","format":false,"excerpt":"Data file: Download the and place to Data folder two files: taxi-fare-test.csv and taxi-fare-train.csv TaxiTrip.cs [code language=\"csharp\"] \/\/ <Snippet1> using Microsoft.ML.Data; \/\/ <\/Snippet1> namespace TaxiFarePrediction { \/\/ <Snippet2> public class TaxiTrip { [LoadColumn(0)] public string VendorId; [LoadColumn(1)] public string RateCode; [LoadColumn(2)] public float PassengerCount; [LoadColumn(3)] public float TripTime; [LoadColumn(4)] public\u2026","rel":"","context":"In &quot;C#&quot;","block_context":{"text":"C#","link":"https:\/\/gantovnik.com\/bio-tips\/category\/c\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1599,"url":"https:\/\/gantovnik.com\/bio-tips\/2022\/10\/210-parametric-curve-in-3d-2-2-2-2-2-2-2-2-2-2-2-2-2-3-3-2-2-3-2-2-4-2\/","url_meta":{"origin":1603,"position":2},"title":"#306 Analyze sentiment of website comments with binary classification in ML.NET using C#","author":"gantovnik","date":"2022-10-27","format":false,"excerpt":"Data file: yelp_labelled.txt SentimentData.cs [code language=\"csharp\"] using Microsoft.ML.Data; \/\/ <\/SnippetAddUsings> namespace SentimentAnalysis { \/\/ <SnippetDeclareTypes> public class SentimentData { [LoadColumn(0)] public string SentimentText; [LoadColumn(1), ColumnName(\"Label\")] public bool Sentiment; } public class SentimentPrediction : SentimentData { [ColumnName(\"PredictedLabel\")] public bool Prediction { get; set; } public float Probability { get; set; }\u2026","rel":"","context":"In &quot;C#&quot;","block_context":{"text":"C#","link":"https:\/\/gantovnik.com\/bio-tips\/category\/c\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1686,"url":"https:\/\/gantovnik.com\/bio-tips\/2022\/11\/210-parametric-curve-in-3d-2-2-2-2-2-2-2-2-2-2-2-2-2-3-3-2-2-3-2-2-4-2-2-2-2-2-3\/","url_meta":{"origin":1603,"position":3},"title":"#319 Scatter plot using ScottPlot.WinForms and C#","author":"gantovnik","date":"2022-11-29","format":false,"excerpt":"1) Install the ScottPlot.WinForms NuGet package 2) Drag a FormsPlot from the toolbox onto the form Form1.cs [code language=\"csharp\"] namespace WinFormsAppEx319 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void formsPlot1_Load(object sender, EventArgs e) { \/\/ generate some random X\/Y data int pointCount =\u2026","rel":"","context":"In &quot;C#&quot;","block_context":{"text":"C#","link":"https:\/\/gantovnik.com\/bio-tips\/category\/c\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2022\/11\/ex319.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2022\/11\/ex319.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2022\/11\/ex319.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2022\/11\/ex319.png?resize=700%2C400&ssl=1 2x"},"classes":[]},{"id":1337,"url":"https:\/\/gantovnik.com\/bio-tips\/2022\/01\/133-create-vectors-and-planes-using-tcl-in-hypermesh-2-2-2-2-2-2-2-2-2-2-2-2-2-2-2-2-2-2-2-2-2-2-2\/","url_meta":{"origin":1603,"position":4},"title":"#249 Creating namespace in tcl","author":"gantovnik","date":"2022-01-05","format":false,"excerpt":"Namespace is a container for a set of identifiers that are used to group variables and procedures. Example: [code language=\"python\"] namespace eval MyMath { # Create a variable inside the namespace variable myResult } # Create procedures inside the namespace proc MyMath::Add {a b } { set ::MyMath::myResult [expr $a\u2026","rel":"","context":"In &quot;tcl&quot;","block_context":{"text":"tcl","link":"https:\/\/gantovnik.com\/bio-tips\/category\/tcl\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":783,"url":"https:\/\/gantovnik.com\/bio-tips\/2020\/11\/135-global-namespace-in-tcl\/","url_meta":{"origin":1603,"position":5},"title":"#135 Global namespace in tcl","author":"gantovnik","date":"2020-11-12","format":false,"excerpt":"#135 Global namespace in tcl It is possible to reference global variables inside procedures using global namespace indicator: [code language=\"python\"] set ::element_list \"1 2 3 4 5\"; proc ::element_info {} { puts $::element_list; set ::node_list \"10 20 30 40\"; puts $::node_list; } element_info; 1 2 3 4 5 10 20\u2026","rel":"","context":"In &quot;HyperMesh&quot;","block_context":{"text":"HyperMesh","link":"https:\/\/gantovnik.com\/bio-tips\/category\/hypermesh\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"_links":{"self":[{"href":"https:\/\/gantovnik.com\/bio-tips\/wp-json\/wp\/v2\/posts\/1603","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/gantovnik.com\/bio-tips\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/gantovnik.com\/bio-tips\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/gantovnik.com\/bio-tips\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/gantovnik.com\/bio-tips\/wp-json\/wp\/v2\/comments?post=1603"}],"version-history":[{"count":0,"href":"https:\/\/gantovnik.com\/bio-tips\/wp-json\/wp\/v2\/posts\/1603\/revisions"}],"wp:attachment":[{"href":"https:\/\/gantovnik.com\/bio-tips\/wp-json\/wp\/v2\/media?parent=1603"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gantovnik.com\/bio-tips\/wp-json\/wp\/v2\/categories?post=1603"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gantovnik.com\/bio-tips\/wp-json\/wp\/v2\/tags?post=1603"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}