Ethical consequences of non-deterministic learning processes?

Most advanced supervised learning techniques are non-deterministic by construction. The final output of the model usually depends on some random parts of the learning process. (Random weight initialization for Neural Networks or variable selection / splits for Gradient Boosted Trees). This phenomenon can be observed by plotting the predictions for a given random seed against the predictions for another seed : the prediction are usually correlated but don't coincide exactly. Generally speaking it is often not a problem. When trying …
Category: Data Science

Points to remember when embarking on an organization-wide turn to AI solutions

In our organization, we are currently in the phase of building up team, skills to automate and implement AI based solutions. So, we are very early in this AI journey. Right now, we are also working on identifying some of the problems that we face in our business. For example, when we get 8 customer segments, but only 2 of them bring in a lot of revenue. Rest all of them perform poorly. We would like to find out why …
Category: Data Science

Do I need to rescale input labels before training (label values between 20..51)?

I'm trying to build model for this datatset (Age prediction): The input image has the shape: 3, 128, 128 and the predicted labels (ages) range between 20 to 51. I want to build model and train it with MSE and R2 metrics. I built the following model: def GetPretrainedModel(): oModel = torchvision.models.resnet50(pretrained=True) for mParam in oModel.parameters(): if False == isinstance(mParam, nn.BatchNorm2d): mParam.requires_grad = False dIn = oModel.fc.in_features oModel.fc = nn.Sequential( nn.Linear(dIn, 512), nn.ReLU(), nn.Linear(512, 256), nn.ReLU(), nn.Linear(256, 128), nn.ReLU(), nn.Linear(128, …
Category: Data Science

Automated Cart Update With Alert Box Each Time

New To PHP and, I am currently attempting to create a plug in that creates an alert box every time the quantity in a cart is changed. So far I have successfully implemented updating the cart automatically, but I am having trouble determining how to create an alert box on update each time that references the new cart total. Any advice would be appreciated. TLDR: Creating a plug in that will display an alert box when you change the quantity …
Category: Web

How can I trust switch_to_blog()?

When I call switch_to_blog() with a blog id, I don’t know whether that blog actually exists. The function returns always true. Test case: switch_to_blog(PHP_INT_MAX); $post = get_post(1); restore_current_blog(); This will result in database errors that are exposed to the user. How can I prevent that? Real-world use case I was the lead developer of MultilingualPress. When a user translates a post, she gets a screen like this: Now the following can happen: She saves the post successfully and continues translating …
Category: Web

Neural Network is non deterministic on validation

We have a regression problem we are trying to solve. We are using Transfer learning by using resnet50 and adding a linear activation layer at the end of it. each image input is 3 layers of synthetic wavelet images (not RGB). since resent uses Relu as an activation function and the fact that the wavelet transformation produces negative values, we have shifted all the data of our images (3Dmatrix) to be positive our label data is between -5 and 5. …
Topic: cnn regression
Category: Data Science

Using gettext on wp-login.php won't change "Back to site name" text

I'm attempting to change the "← Back to sitename" text on the wp-login.php page using gettext but not having much luck. No matter what I try it doesn't seem to want to work, although I've had success changing the "Lost your password?" text using the same method. Here is my latest snippet function custom_login_text ( $text ) { if (in_array( $GLOBALS['pagenow'], array( 'wp-login.php', 'wp-register.php' ) )) { if ($text == '← Back to %s'){$text = 'Test';} return $text; } } …
Category: Web

Binary Classification Comparing two time series of variable length

Is there a machine learning model (something like LSTM or 1D-CNN) that takes two time series of variable length as input and outputs a binary classification (True/False whether time series are of same label)? So the data would look something like the following date value label 2020-01-01 2 0 # first input time series 2020-01-02 1 0 # first input time series 2020-01-03 1 0 # first input time series 2020-01-01 3 1 # second input time series 2020-01-03 1 …
Category: Data Science

SSL certificate verify failed

I have a gift voucher plugin for wordpress that creates a PDF after a user has finished filling in a form and sends it to the users email. This plugin uses the fpdf library to create the pdf. It worked fine before my web hotel installed OpenSSL/1.0.2g. Now I think that the SSL certificate blocks the pdf creation. I'm getting the following error message: PHP Warning: fopen(): SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed …
Category: Web

Link breadcrumbs to actual page – not the category archive

Status quo: the breadcrumbs show the following structure: home/parent-category/sub-category/post And click on parent-category or sub-category links to the default archive pages. This is also the correct hierarchy based on our navigation menu. So in the example above it is home/parent-page/sub-page/post. We want the breadcrumbs link to the actual page and not to the archive page of the category. In the Yoast-Settings > Search Appearance > Breadcrumbs under “Taxonomy to show in breadcrumbs for content types” I can set “Category” for …
Category: Web

Ajax not working to insert, query and result data

On my site, through a form I send/register same information in database, do a SELECT/query and return it! Return the last table saved in database, just that user just entered on the form (along with some more information coming from the database). How I want to display these values coming from databse in a modal bootstrap it's necessary that the page doesn't give the refresh. For this, I inserted the AJAX as follows: $(document).ready(function(){ $('#enviar').click(function(){ $.ajax({ //CAAL AJAX IN WORDPRESS …
Category: Web

Keras - add_weight() method not adding to total model parameters

I am creating a custom Keras layer FConv2D(), and adding a weight in its build() function using the add_weight() method as suggested in official Keras tutorial for creating custom layers. def build(self, input_shape): shape = tf.TensorShape(input_shape).as_list() h = shape[1] w = shape[2] in_channels = shape[3] self.kernel = self.add_weight( shape=(h,w,in_channels,self.num_outputs), initializer="random_normal", trainable=True, ) super(FConv2D, self).build(input_shape) But when I print the summary of a single-layer model containing just this layer, the number of parameters in this layer is shown to be 0. …
Category: Data Science

Does something like is_rest() exist

I am starting a bit with the REST API. If I am not completly mislead, the init action hook is also executed when its a REST API request. Now, I want to execute some code only, when it is not a REST API request. So I was looking for a command like is_rest() in order to do something like <?php if( ! is_rest() ) echo 'no-rest-request'; ?> But I couldn't find something like this. Is there a is_rest() out there?
Category: Web

Pagination doesn't work on static front page

Static front page pagination working fine on localhost. but when i uploaded the to server online its not working. i am using infinite scroll. the issue is only with static front page, when i don't use static front page then it works. here is my code, help will be really appreciated! <?php /* Template Name: Layout 1 */ ?> <?php get_header(); ?> <div class="main"> <div class="container"> <div class="sixteen columns"> <div class="portfolio-all-main"> <?php if ( get_query_var('paged') ) { $paged = get_query_var('paged'); …
Category: Web

Tensorflow: Unable to Save checkpoint after every 2 global steps during training the SSD model object detection

python models/object_detection/train.py --logtostderr --train_dir=training/ --pipeline_config_path=training/ssd_inception_v2_coco.config INFO:tensorflow:Restoring parameters from /home/rahul/Downloads/ssd_inception_v2_coco_2018_01_28/model.ckpt INFO:tensorflow:Running local_init_op. INFO:tensorflow:Done running local_init_op. INFO:tensorflow:Starting Session. INFO:tensorflow:Saving checkpoint to path training/model.ckpt INFO:tensorflow:Starting Queues. INFO:tensorflow:global_step/sec: 0 INFO:tensorflow:Recording summary at step 0. INFO:tensorflow:global step 1: loss = 14.1708 (73.929 sec/step) INFO:tensorflow:global step 2: loss = 13.3957 (26.779 sec/step) INFO:tensorflow:global_step/sec: 0.0207936 INFO:tensorflow:Recording summary at step 2. INFO:tensorflow:global step 3: loss = 13.2996 (34.331 sec/step) INFO:tensorflow:global step 4: loss = 12.6129 (27.737 sec/step) INFO:tensorflow:global step 5: loss = 12.0835 (28.638 sec/step) INFO:tensorflow:global step 6: …
Category: Data Science

Compare ACF date field (if exists) and post date and order DESC

I have an ACF date field (same format as post date) and in my Query I want it to be compared to the publish date of the post: If erstelldatum is not empty use erstelldatum for order If erstelldatum is empty use publish date for order instead Order descending My code is working so far but the order isn`t right. It lists all posts with erstelldatum first followed by those without. I want them to be ordered descending by the …
Category: Web

Dimension Mismatch Error during dot product in Python

I have two matrices user_vecs and item_vecs I am trying to take the dot product of the two to build a recommendation engine: The shape of the two vectors are as follows: user_vecs.shape (20051, 20) item_vecs.shape (20,1808) When I take the dot product of the transpose as follows: a = user_vecs.dot(item_vecs.transpose()) I get the following error: --------------------------------------------------------------------------- ValueError Traceback (most recent call last) <ipython-input-41-f4cd01978711> in <module> ----> 1 a = user_vecs.dot(item_vecs.transpose()) C:\ProgramData\Anaconda3\lib\site-packages\scipy\sparse\base.py in dot(self, other) 362 363 """ --> 364 …
Category: Data Science

IterativeImputer Evaluation

I am having a hard time evaluating my model of imputation. I used an iterative imputer model to fill in the missing values in all four columns. For the model on the iterative imputer, I am using a Random forest model, here is my code for imputing: imp_mean = IterativeImputer(estimator=RandomForestRegressor(), random_state=0) imp_mean.fit(my_data) my_data_filled= pd.DataFrame(imp_mean.transform(my_data)) my_data_filled.head() My problem is how can I evaluate my model. How can I know if the filled values are right? I used a describe function before …
Category: Data Science

How to add refund in custom payment gateway woocommerce

I want to add refund to the woocommerce-payment-gateway in class WC_Custom_Gateway extends WC_Payment_Gateway function __construct() { $this->supports = array('products', 'refunds'); $this->id = 'custom'; $this->icon = plugins_url('../assets/custom-logo.png', __FILE__); $this->has_fields = true; $this->method_title = 'Custom'; $this->method_description = 'Payment using Custom card'; $this->init_form_fields(); $this->init_settings(); $this->title = sanitize_textarea_field($this->get_option('title')); $this->description = sanitize_textarea_field($this->get_option('description')); $this->enabled = sanitize_key($this->get_option('enabled')); $this->discount = intval($this->get_option('discount')); $this->token = sanitize_text_field($this->get_option('token')); $this->client = sanitize_text_field($this->get_option('client')); $this->back_url = esc_url_raw($this->get_option('back_url')); $this->response_type = $this->get_option('response_type'); add_action('woocommerce_update_options_payment_gateways_' . $this->id, array($this, 'process_admin_options')); // if (is_admin()) { // add_action('woocommerce_update_options_payment_gateways_' . $this->id, array($this, 'process_admin_options')); …
Category: Web

Why is XGBClassifier in Python outputting different feature importance values with the same data across different repetitions?

I am fitting an XGBClassifier to a small dataset (32 subjects) and find that if I loop through the code 10 times the feature importances (gain) assigned to the features in the model varies slightly. I am using the same hyperparameter values between each iteration, and have subsample and colsample set to the default of 1 to prevent any random variation between executions. I am using the scikit learn feature_importance_ function to extract the values from the fitted model. Any …
Category: Data Science

WooCommerce plugin acceptance time

We have been waiting for an acceptance of our plugin for WooCommerce since September 2021. A month or so ago we got a reply that not long left. The solution is already in use by a number of customers, but we would like to have it more easily available. The same solution is already accepted by Shopify and Magento with many more happy customers. I really dont understand what is this, zero feedback so no changes requested. Are we getting …
Category: Web

Using Product variations as product addons

This is more a question for advice than a bug or problem. I'm building a Woocommerce based plugin and I was looking to at way of using the core woocommerce/ wordpress as best as possible without the need for dependencies. My question for advice centres around using variations also as product addons as I'm trying to develop the functionality of being able to Offer "checkbox" type variations Allow selection of multiple variations per attribute that is used for the variations …
Category: Web

Orange v3.32: Accuracy and precision not showing up

As explained in the orangehelp files the test and score widget would provide an accuracy colum like "CA". I only have MSE RMSE MAE and R2 besides the times. Furthermore, the predictions widget has a tickmark in the lower left with text "show performance scores". Nothing happens if ticked or not. Last but not least the evaluation results won't be displayed in the confusion matrix, also. What am I doing wrong? I test and score with cross-validation or random sampling. …
Category: Data Science

loading a php file to a specific page id

I'm trying to assign a php file to a specfic page? I have modals stored in different files and want have them load in when their assigned page is called. These pages are using the same theme, "Portfolio". If I do something like: <?php $id="page-id-8229"; include '/modals/work/cplfModals.php';?> for each file in my Portfolio template, each page will still load all of the modals that are assigned, not just the one that I'm try to assign to that page. Is there …
Category: Web

Conditional tag search-no-results

Is there a way to make a conditional tag that tests if it is search-no-results page? I know that there is a function to check if is_search() page: if(is_search()){ echo "search page"; } But I didn't found a way to check for search-no-results, and I noticed that WordPress gives body class with search-no-results to this page.
Category: Web

creating a custom post template

I want to customize my individual posts. I have an example of what I'm trying to achieve below. Would I make a custom post template for this? If so how would I do this? Or should I add to my single.php? Thanks in advance. What I want my individual post pages to look like. I want two pictures side by side that are the full width of the page. Text. One picture that is the full width of the page. …
Category: Web

Customising Objective Function in R

I wondered if there were R packages that allow the user to customise the loss function? For example, if a random forest package like ranger had a loss function which minimises OOB MSE. Is it somehow possible to customise this into a model which minimises negative log likelihood? Would appreciate if someone knew of examples/code of doing this on a toy dataset
Category: Data Science

How can I create network with different domains?

I have heard similar questions posed but not exactly what I am looking for. Is it possible to create a multisite with different domains and sub.doamins? For example, can I create a network that allows me to create build: SiteName1.com is a BuddyPress video community. DomainName2.net is an online shop that sells products. TheDomain3.co is a web design & hosting company that creates and manages other websites. Users must be able to create subsites of their own like (username.TheDomain3.co) Also …
Category: Web

Too many hours for Training Custom Object Detector

I am following this tutorial: https://tensorflow-object-detection-api-tutorial.readthedocs.io/en/latest/training.html When I reach the training paragraph ( Training the Model ) and run this command: python3 model_main_tf2.py --model_dir=models/my_ssd_resnet50_v1_fpn --pipeline_config_path=models/my_ssd_resnet50_v1_fpn/pipeline.config I get mesages like this: Instructions for updating: `seed2` arg is deprecated.Use sample_distorted_bounding_box_v2 instead. W0128 18:24:29.575707 140532950755136 deprecation.py:341] From /usr/local/lib/python3.9/dist-packages/tensorflow/python/util/dispatch.py:1096: sample_distorted_bounding_box (from tensorflow.python.ops.image_ops_impl) is deprecated and will be removed in a future version. Instructions for updating: `seed2` arg is deprecated.Use sample_distorted_bounding_box_v2 instead. WARNING:tensorflow:From /usr/local/lib/python3.9/dist-packages/tensorflow/python/autograph/impl/api.py:465: to_float (from tensorflow.python.ops.math_ops) is deprecated and will be removed in a …
Topic: cnn training
Category: Data Science

Youtube iframe embed keeps disappearing from page

I am trying to embed a video on my homepage. I add the embed code from YouTube and paste it into a custom html blog on the gutenberg editor. I click update and check my website and the video is there. I refresh the page and the video disappears. I go to the page editor and the embedded code for the video has been removed. Please can someone tell me why this is happening? I have tried to research it …
Category: Web

Getting the Image Title (not the post title)

I've tried over a dozen variations of getting the title now, with mixed results. I get an error, blank output, or the post title, but not the image title. For reference, here's the complete image code (with my latest attempt) I'm using in posts: <?php if ( has_post_thumbnail() ) : ?> <a href="<?php $src = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'full', false ); echo esc_url( $src[0] ); ?>" title="<?php the_title( $attachment_id ); ?>"><?php the_post_thumbnail( 'full', array( 'itemprop' => 'image' ) ); …
Category: Web

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.