The Events Calendar EventURL not displaying

I have a custom footer with events being brought in. However, links are no longer showing while using tribe_get_event_meta. The link given is just my home url link and not the link to the event page. My link code is <?php global $post; $i = 0; $events = tribe_get_events( array( 'posts_per_page' => 3, )); foreach ( $events as $post ) { setup_postdata( $post ); ?> <a class="event-links" href="<?php echo tribe_get_event_meta( get_the_ID(), '_EventURL', true ); ?>" target="_self"> <li class="evlist" id = …
Category: Web

Bottling a Doom Bar clone at high SG

Bonjour, I have brewed a Doom Bar clone. I was aiming at an Original gravity of 1.045 but only managed 1.041. Unfortunately I lost temperature in the ferment and it stuck at 1.020 after 7 days and has remained here. I heated it up and stirred but no action. I have now racked and am clarifying at 4°C. I am going to bottle tommorow. Should I add priming sugar? I am afraid of bottles exploding. Any advice appreciated
Category: Mac

Benefits of using Deep Learning-specific hyperparameter optimization tools vs. sklearn?

There are quite a few library for hyperparameter optimization that are specific to Keras or other Deep Learning libraries, like Hyperas or Talos. My question is, what's the main benefit of using these libraries compared to, for example, sklearn.model_selection.GridSearchCV() or sklearn.model_selection.RandomizedSearchCV?
Category: Data Science

Bulk 301 redirect for custom post type

I've amended the URLs for my custom post type from: url.com/jobs/job-name to url.com/jobs/job-location/job-name Problem is, because this isn't a standard rewrite wordpress doesn't do the 301 redirecting for you. Does anyone know how I could do a 301 redirect for all custom posts to the new URL bearing in mind that job-location would be different depending on the post? Thanks!
Category: Web

How to draw each ROC curve of an SVM model with cross validation

I would like to make a graph like the following in python: That is, one curve for each fold. I have the following code where I use an SVM model to classify some data kf = KFold(n_splits=10) a, fma, fmi = [], [], [] for train, eval in kf.split(x_train): x_train_i, x_eval_i, y_train_i, y_eval_i = x_train[train], x_train[eval], y_train[train], y_train[eval] c = svm.SVC(kernel='rbf', gamma='scale', C=40).fit( x_train_i, y_train_i ) p = c.predict(x_eval_i) acc = c.score(x_eval_i, y_eval_i) f1ma = f1_score(y_eval_i, p, average='macro') f1mi = …
Category: Data Science

How do I modify the position of a plugin?

I am trying to modify a plugin but I'm a tech newbie. My plugin is for a floating mini cart. it's a great plugin but the position options are limited to "left-middle" or right-middle". I would like it to be shown in the "left-bottom" position of my site. I found an area in the plugin editor that mentioned it's current position (left-middle). I was hoping by simply changing the word "middle" to "bottom" it would work but it did not. …
Category: Web

Search Character Set Problem

I have a local WordPress setup in the Turkish language. I have a post title like ... MAMASI .... When I search by keyword maması in lower-case it doesn't find post. I try the table Character set utf8mb4_unicode_ci, utf8mb4_general_ci, utf8_unicode_ci, utf8_general_ci, utf8_turkish_ci but it gave me same result. How can I solve Iı sensivite problem?
Category: Web

Display parent page URL for child page

I have this code that is working but is giving me the wrong link gives me this link example.com/index.php/sample-page/ but I need this link example.com/sample-page/ <?php global $post; if ( $post->post_parent ) { ?> <a href="<?php echo get_permalink( $post->post_parent ); ?>" > <?php echo get_the_title( $post->post_parent ); ?> </a> <Br><?php echo get_permalink( $post->post_parent ); ?> <?php } ?>
Category: Web

How do you find the eigenvalues of the matrix for the following momentum gradient descent?

The following question is based purely on the material available on MIT's open courseware youtube channel. (https://www.youtube.com/watch?v=wrEcHhoJxjM). In it, Professor Gilbert Strang explains the general formulation of the momentum gradient descent problem and ultimately arrives at optimum values (40:05 in the video) for the variables $s$ and $\beta$. \ $\textbf{Background}$ Lets begin with the standard gradient descent not covered in this video. The equation for this is: $x_{k+1}=x{k}-s \nabla f(x_k) $ $s$ is the step size, $f(x_k)$ is the value …
Category: Data Science

How to get several fields from wp_query?

I'm going to get several fields from wp_query result. I know about wp_list_pluck() function, but it accepts only one field paramether. How to get several ones if I'd like to take several parameters from each post found? [ Object1 (ID, name, tag), Object2 (ID, name, tag), Object3 (ID, name, tag), etc. ] Thank you for your help afterwards! My code excerpt is here: $search_param = get_param('search_param', null, 'text'); // POST param $term_id = get_term_by('name', "$search_param", 'image_color')->term_id; $args = array( 'post_type' …
Category: Web

Performing 1D Depthwise conv using Keras 2D Depthwise conv

I would like to perform a 1D Depthwise convolution (ie the first step of the depthwise-separable convolution) for a machine learning model I am working on. This means that for an input activation space of h x w, there are h kernels, each 1xk, where k is the length of the kernel (see attached figure). This is not currently offered by Keras, but one can use the available Depthwise 2D convolution (which operates on 3D inputs), and simply add an …
Category: Data Science

Using custom layers in Functional API

I am trying to write a custom layer using subclassing in Keras and then use it in functional API. I followed the advise in the documentation - https://www.tensorflow.org/guide/keras/custom_layers_and_models#you_can_optionally_enable_serialization_on_your_layers but its not working for me. Here is my code snippet- from tensorflow import keras from tensorflow.keras import layers class conv2D_Block(keras.layers.Layer): def __init__(self, filters, kernel_size=(3,3), strides=1, padding='same', pool_size=(2,2), **kwargs): super().__init__(**kwargs) """ self.filters = filters self.kernel_size = kernel_size self.strides = strides self.padding = padding self.pool_size = pool_size """ self.convlayer = layers.Conv2D(filters, kernel_size, strides …
Topic: keras
Category: Data Science

Script widget works only in admin view but not in Public

Script Widget bug in WordPress. The embed widget from Funda was working before, clueless why it suddenly stopped working. In Public view, it's not working. Preview mode while logged in to WordPress shows the correct page. Actually, the same embedded script from FUNDA is working on this page https://www.homecrew.nl/rent-out/. But the issue is with this page. The script isn’t working on this page https://www.homecrew.nl/reviews-recensies-beoordelingen-klanten-engels/. The Editor & method of placing the script is the same. I cleared the cache etc. …
Category: Web

"Invalid value" in RMSprop implementation from scratch in Python

Edit 2: The regularization term (reg_term) is sometimes negative due negatative parameters. Hence S[f"dW{l}"] contains some negative values. I realize the reg_term has to be added before taking the sqrt, like this: S[f"dW{l}"] = beta2 * S[f"dW{l}"] + (1 - beta2) * (np.square(gradients[f"dW{l}"] + reg_term)) Edit 1: I see that S[f"dW{l}"] contains some negative values. How is this possible when np.square(gradients[f"dW{l}"] always contains positive values? I have implemented a neural network from scratch which uses mini-batch gradient descent. The network …
Category: Data Science

After changing wp from subdirectory to root I can't preview any changes to a page or post

I followed the guideline from WP Codex. Changed the site url in general settings Copied the .haccess and the index.php files from the subdirectory to the root Edited the root index.php (new copied file in root) from: '/wp-blog-header.php' ); to '/subdirectory/wp-blog-header.php' ); checked the permalink structure. the following code is in the new copied root .haccess file # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] …
Category: Web

Is it possible to insert text into an html tag using functions.php?

Here's what I mean: I am using a plugin called 'pods' which allows for the creation of Custom (CPT) and for relationships to be formed between those CPT's. However - there's a little flaw that I can see in that I have created a CPT for US States, so each CPT is one individual state which means that each post that is created within this CPT just has the title of the state. Here's the HTML and associated CSS <header …
Category: Web

Is it possible to implement an rdd version of a for loop having map and reduce using pyspark?

I need to test an algorithm that computes a function on a dataframe where in each execution I drop a column and computes the function. This is a example in python pyspark but without using rdd: df2581=spark.sparkContext.parallelize([Row(a=1 ,b=3,c=5,d=7,e=9)]).toDF() df2581.show() wo = df2581.rdd.flatMap(lambda x: x[1:] ).map(lambda a:print(type(a))) wo.collect() def f(x): list3 = [] index = 0 list2 = x for j in x: list = array(x) list.remove(list[index]) list3 = list.copy() index += 1 return list3 colu= df2581.columns def add(x,y): return x+y …
Category: Data Science

Unbalanced data set - how to optimize hyperparams via grid search?

I would like to optimize the hyperparameters C and Gamma of an SVC by using grid search for an unbalanced data set. So far I have used class_weights='balanced' and selected the best hyperparameters based on the average of the f1-scores. However, the data set is very unbalanced, i.e. if I chose GridSearchCV with cv=10, then some minority classes are not represented in the validation data. I'm thinking of using SMOTE, but I see the problem here that I would have …
Category: Data Science

Find out what is using PHP sessions in WordPress

Is there a way to find out what is using PHP sessions or spawning PHP processes? My Wordpress site gets heavy traffic (3.5 million hits per month). We discovered recently that we had permissions set incorrectly for a long time, meaning nothing could access PHP sessions. Unfortunately, after we fixed permissions, we found that tons of PHP processes are being spawned rapidly and the server goes completely unresponsive. It won't even come back from health check. It's a dedicated Nginx …
Category: Web

What kind of Keras data classification mode should I pick for my kind of machine learning problem?

So I have to come up with a machine learning model for a specific problem that I have. As far as I know, Keras allows for four different types of classification: Binary, Categorical, Multiclass Classification, and Multilabel Classification. However, I think my problem is so specific that I could use some guidance to see what is the correct type of classification or if I need a different type. I've got a dataset of clothing items that are divided into two …
Category: Data Science

Normalizing data from same variable but different individuals

I'm new to machine learning. I have the following scenario: I have five individuals that are each carrying an accelerometer. That sensor measures movement/acceleration on a scale from 0 to 255, 0 being no movement, 255 being max movement (at a 5-minutes interval). Some individuals carry sensors that are more sensitive, and some that are less sensitive. As such, some individuals' sensors will provide higher values, and some individuals' sensors will provide lower values, for the same movements. Using a …
Category: Data Science

All files being pulled from wp-content returning 404 error

I am on a fresh install of Wordpress on Ubuntu / LAMP, and noticed that none of my site's images are showing. I tried to install a theme (Sydney) and none of the images were showing up. I was able to fix this by manually installing the theme to the wp-content directory. You can see in the image below that all of the files being requested from wp-content are returning 404 errors. I tried uploading images, but they are returning …
Category: Web

How to load all images using image_dataset_from_directory function?

I am working on a multi-label classification problem and faced some memory issues so I would to use the Keras image_dataset_from_directory method to load all the images as batch. How do you apply a multi-label technique on this method. I have these folders: ['Tomato_BacterialSpot', 'Tomato_EarlyBlight', 'Tomato_Healthy', 'Tomato_LateBlight'] I am generating class names using the below code. Here is the sample code tutorial for multi-label but they did not use the image_dataset_from_directory technique. label = imagePath.split(os.path.sep)[-2].split("_") and I got the below …
Category: Data Science

Prediction for package delivery to summarize packages

I have the problem, that a customer can buy something. Now I want to predict if the customer is buying another things in the next few days. So that you can summarize the packages and delivery not every package individually. Has someone read a similar issue? My data looks like customerid order article mandatoryDeliveryDate 1 03.05 Shoes 05.05 1 04.05 Paper 05.05 2 10.04 PS5 11.04 2 12.04 Laptop 16.04 3 28.04 Clock 30.04 3 [XXX] What I want to …
Topic: prediction
Category: Data Science

Optimum weights for weighted average of 3 prediction models

I have 3 sklearn models which I use to predict a probability score for a binary classification problem. I want to create a weighted average score of all the predictions made by these models. I am stuck at how to find the optimum weights. I have tried to create a weighted average method that would help me: def weighted_average(prob: dict, weights: dict = base_weights): '''Weighted average of all probabilities Prob Dict structure: { 'mfcc': probability of spoof from MFCC Model, …
Category: Data Science

Negative examples for a Yes/No image classification neural network

I am trying to retrain a neural network using transfer learning that can classify whether an image has a certain object, say, a car. My positive sample dataset is quite small, only 2500~ images. It works really well with "regular" binary classification (2500 images of cars/2500 images of flowers and it has to differentiate between those two), but the problem is that I am not sure how to make it classify for all types of images, or how to make …
Category: Data Science

how to get json file in wordpress template

I am trying to get data from JSON file in Wordpress template using file_get_contents But can not get the file $data = file_get_contents("../assets/data2.json"); $arr = json_decode($data, true); Facing this error while var_dump $data object(WP_Error)#825 (2) { ["errors"]=> array(1) { ["http_request_failed"]=> array(1) { [0]=> string(29) "A valid URL was not provided." } } ["error_data"]=> array(0) { } } My data2.json file is in the assets folder and trying from templates folder in theme folder in wordpress.
Category: Web

Add posts to custom table in database instead of wp_posts

What the code does: Imports posts, loops through all the posts and calls wp_insert_post to create a new posts for each import. Objective: Import posts and store them in another table, not under the wp_posts table, but retain the associated wp_postmeta tables. Issues: For some reason, in it's current state, the new table doesn't get created and the posts don't get inserted - What am I doing wrong? I'd like to import the posts to the new table. Since I …
Category: Web

MNIST data shape

In going through the different tutorials on CNN, autoencoders, and so on I trained myself on the MNIST problem. The different images are stored in a 3D array which shape is (60000,28,28). In some tutorials for the first layer of CNN they use the Flatten function keras.layers.Flatten(input_shape=()) but in other tutorials, they transform the 3D Array in A 4D Array (60.000, 28,28,1 ) that I suppose is identical that use the Flatten function? Am I right? Why there are two …
Category: Data Science

Creating a post with the REST API, curl and oauth returning 401 error

I'm trying to create a WordPress post using the REST API, OAuth, and cURL. However, I'm running into some trouble. I'm able to create a blank post (no title, slug, etc) using the following code: $header = array(buildAuthorizationHeader($oauth), 'Expect:'); $options = array( CURLOPT_HTTPHEADER => $header, CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 30, CURLOPT_POST => true, CURLOPT_URL => $url, CURLOPT_CUSTOMREQUEST => "POST", CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_RETURNTRANSFER => true, CURLOPT_SSL_VERIFYPEER => false); This works as expected - authorizes successfully, and …
Category: Web

Custom loss for classification of geolocation in Keras

I have a model that predicts geolocation coordinates based on some data. The way I have it set up at the moment is that I clustered my points (2D coordinates) into 100 classes that my model predicts with categorical crossentropy as the loss. I realized that this penalizes predictions of (phisically) neighbouring classes just as much as those that are far apart. Ideally my loss would be the euclidian distance between the prediction and the class centroid but then my …
Category: Data Science

How to improve L2 loss for generative autoencoder

I am working with a modified generative autoencoder and having issues getting the L2 sufficiently low. I think problem is that because my data is over a very large range and is standardized to values between zero and one, small discrepancies in the standardized data lead to larger ones in the unstandardized data. Additionally, my other loss terms, despite being averaged by number of points in the batch, are usually orders of magnitude larger than my L2 loss, which I …
Category: Data Science

About

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