I need to do something like that: $postsOrder = get_sub_field('posts-ordering'); if ($postsOrder = 'post_views_count') { $queryPopular = array ( 'meta_key' => 'post_views_count', 'orderby' => 'meta_value_num', ); } $query = new WP_Query( array( 'posts_per_page' => $postsCount, 'post_type' => $postsType->name, 'order' => 'DESC', 'orderby' => $postsOrder, 'taxonomy' => $postsTaxonomy, $queryPopular ), ); The point is that if $postsOrder is equal 'post_views_count', then in $query should be added two another parameters. How to do it right?
The preview function works fine when posts are just draft. The url looks like this : http://exemple.domain.com/blog/?p=12&preview=true Then when I pubish my posts, let's say I want to change something and preview it, the url looks like this : http://exemple.domain.com/blog/my-article-title/?preview=true&preview_id=12&preview_nonce=514e88946a&post_format=standard The problem is it does reflect any changes ... I use WordPress 3.9.2 running Twenty Fourteen theme without any plugins EDIT I've turn the permalink to default and it resolve the problem. But I need it to work using the …
I'm confused when I add data augmentation should I get more data or the same data I tested my x_train length to confirm but I got the same length before augmentation and after augmentation is that correct or should I get the double of my data? print(len(x_train)) output : 5484 after augmentation : datagen = ImageDataGenerator( featurewise_center=True, # set input mean to 0 over the dataset samplewise_center=True, # set each sample mean to 0 featurewise_std_normalization=True, # divide inputs by std …
I have trained my multiclass SVM model for MNIST classification in Python using scikit-learn using the following code: from sklearn.svm import SVC from sklearn.model_selection import GridSearchCV parameters = {'kernel':['rbf'], 'C':[1, 10, 100, 1000], 'gamma':[1e-3, 1e-4]} clf = GridSearchCV(SVC(), parameters) clf.fit(xtrain, y_train) svmclf = clf.best_estimator_ svmclf.fit(xtrain, y_train) I wanted to get some parameters of the trained SVM: support vectors, alpha values and bias. So I tried this: SVs= clf.best_estimator_.support_vectors_ Alpha= clf.best_estimator_._dual_coef_ bias=clf.best_estimator_.intercept_ I checked the shape of these parameters and it …
My posts can have any of 2 categories: 1. red 2. blue I have 2 different category pages category-red.php category-blue.php A post can be in both red and blue category If a posts opens from the red category I want it to have a single-red style even if it also belongs to the blue category. is that possible?
I want to predict bacteria plate count in the water from time series(around 10000 values in a row) of water temperature on a one minute granularity, and other daily climate data including min and max temperature, rainfall, solar exposure, day_of_the_week etc for a sequence of 20 days each before the sample was collected for test. There are 700 different locations in the building. My initial approach was to join all time series of the same location into one row/one series. …
I want to add lang query variable to existing URL. I have registered query variable: add_filter('query_vars', 'custom_add_query_vars'); function custom_add_query_vars($vars){ $vars[] = "lang"; return $vars; } The following code works good everywhere but not when I'm currently on the home page. <?php global $wp; ?> <a href="<?php echo add_query_arg(array('lang' => 'en'), $wp->request); ?>">English</a> Is there a problem with the code? On the homepage URL becomes http://localhost/mywebsitename/?lang=en which should be ok but supposedly it tries to load index.php instead of page.php, which …
I've got Genesis-blocks plugin installed (it got updated from Atomic blocks). I am using blocks and resuable blocks to create pages. The problem I am facing is, most of these blocks inject their own inline styling, e.g. button block creates an anchor tag, but it gives inline styling for background-color and text-color as well. Doing my own research I found that the default appearance of these blocks can be edited with javascript api, but the docs don't tell which javascript …
Most of the NLP stuff I've been looking at does NER given a long blob of text (e.g., a news article). I am curious what the best method is when you have millions of short strings, say for example names: Mr. Foo Bar John Doe, MBA, PhD Say I want to create a model that recognizes the position of the word MBA, the fact that it is surrounded by commas, and so on, and tags based on that. Is NLP …
I'm a little new to Wordpress/Woocommerce but am fumbling my way through... We have Woocommerce installed and working where we request billing address and billing phone number (amongst other things) and I am trying to show this data on the backend users (view all) table as it currently only pulls its data from the base Wordpress registrations details, not from Woocommerce. Any help would be greatly appreciated. Update: This is where I am hoping to add some extra columns using …
I have data that has been grouped into 27 groups by different criteria. The reason for these groupings is to show that each group has different behavior. However, I would like to normalize everything to the same scale. For example, I would like to normalize to a 0-1 scale of 0-100, that way I could say something like $43^{rd}$ percentile and it would have the same meaning across groups. If I were to just, say, standardize each individually by subtracting …
I'm trying to determine what is the best number of hidden neurons for my MATLAB neural network. I was thinking to adopt the following strategy: Loop for some values of hidden neurons, e.g. 1 to 40; For each NN with a fixed number of hidden neurons, perform a certain number of training (e.g. 40, limiting the number of epoch for time reasons: I was thinking to doing this because the network seems to be hard to train, the MSE after …
I have a Taxonomy, “Genre”. “Genre” has a Term, “advert”. I want my taxomomy template to grab all Custom Posts attached to that term, sort them by my last_name, first_name, short_title Custom Fields, and output. But my custom query is returning 0 posts! I would love to get another set of eyes on this. I’m missing something! <?php $args = array( 'tax_query' => array( array( 'taxonomy' => 'genre', 'terms' => array( 'advert' ) ) ), 'meta_query' => array( 'relation' => …
One news aggregator wants to have RSS feed without any links into the <description> field. So I try to use this code in functions.php to remove <a href></a> tags, but it doesn’t work. What’s wrong? How can I remove the tags but keep intact all the text? add_filter('the_content', 'my_custom_feed'); function my_custom_feed( $content ){ global $post; if ( ! is_feed() ) return $content; // Remove all shortcodes $content = strip_shortcodes( $post->post_content ); $content = strip_tags( $content ); // Remove all html …
I would like to run SVM for my classification problem using the Earth Mover's Distance (EMD) as a distance measurement. As I understood the documentation for Python scikit-learn (https://scikit-learn.org/stable/modules/svm.html#svm-kernels) it is possible to use custom kernel functions: import numpy as np from sklearn import svm def my_kernel(X, Y): return np.dot(X, Y.T) clf = svm.SVC(kernel=my_kernel) Also there is a package with EMD implemented (https://pypi.org/project/pyemd/). I tried to run it similar as in example using my own data (below). I have distributions …
I have a website hosted on server that doesn’t have any server cache , neither any wp cache plugins are installed and when I try to edit a page it returns a blank page with message “the editor encountered an unexpected error” and looing in the console I see this error: Uncaught TypeError: Cannot destructure property ‘setUsedPageOrPatternsModal’ of ‘(0 , a.useDispatch)(…)’ as it is null. related on page-patterns-plugin.tsx:20. Maybe it is something related to WordPress.com block editor toolkit plugin that …
I'm trying to get WP_Query to display ALL posts in an array but only ones with status published are showing: global $wp_query; $ids = array(130, 132); $args = array( 'post_status' => array('publish', 'pending', 'draft', 'auto-draft', 'future', 'private', 'inherit'), // 'post_status' => 'any', // same output 'post__in' => $ids, 'post_type' => 'alpha' ); $q = new WP_Query($args); foreach ($q->posts as $post) { echo $post->id; } However this displays post id's regardless of their status: // post status foreach ($ids as $id) …
I am testing plugin upgrades on a staging instance before applying them to production. But if there are any delays in this process, I may end up being prompted to upgrade to a newer, untested version on production. If prompted to upgrade a plugin, how can I choose an intermediary update, rather than the latest?
I'm training an object detection model with Tensorflow and monitor the training task with tensorboard. I was expecting in the Images tab of tensorboard that displayed images would show a bounding box (at a specific point of training). What I see though is only images with an orange line drawn above the picture (the same orange that I expect for the bounding box). Am I missing something? Am I right when I say that a bounding box should appear or …
I am using XGBoost for a multi-label classification problem (objective is 'multi:softmax' in XGBoost). In my case there are 16 discrete output labels where only one is correct. However, depending on the example, there are particular predicted labels that are "close to correct" that deserve some sort of partial credit/boost for being closer to the answer than other labels. I want to see if I can modify the objective/loss function in XGBoost to account for this. The user gets more …
I have add some image size like: add_image_size( 'custom-small', 600, 600 ); add_image_size( 'custom-medium', 1280, 1280 ); add_image_size( 'custom-large', 2560, 2560 ); and I have removed all the default sizes. Now the Media Library in the Admin panel is loading full image instead of medium. Is it possible to specify a custom size to use?
I am using the Easy Digital Downloads plugin to sell my music. I would like to add a custom search form inside the downloads archive page so the results will be displayed on that page. For example, if you'll go to storename.com/downloads and search for 'whatever', you'll find all the songs that contain 'whatever' in their title. So, inside the archive-download.php file I added: <div class="search-in-store"> <form role="search" method="get" id="searchform" class="searchform" action="<?php echo home_url( '/downloads/' ); ?>"> <div> <label class="screen-reader-text" …
In [*] page 264, a method of drawing a missing value from a conditional distribution $P(\bf{x}_{mis}|\bf{x}_{obs};\theta)$ which is defined as: I did not find any code implementation of this approach. My question is, how to implement it? Should we integrate the distribution w.r.t an assumed interval of $\bf{x}_{mis}$? Otherwise, is this just an intuitive mathematical representation that should be understood but the implementation is different. [*] Theodoridis, S., & Koutroumbas, K. “Pattern recognition. ” Fourth Edition, 9781597492720, 2008
Hi guys I want to ask if anyone knows how to vectorize this code to make it more optimal and faster. loss = 0 total_steps = 0 for i in range(len(distances)): for j in range(len(distances)): for k in range(len(distances)): if not ((i == j) | (i == k) | ( j==k )): if similarities[i][j] >= similarities[i][k]: loss += (distances[i][j] - distances[i][k]).clip(min=0) else: loss += (distances[i][k] - distances[i][j]).clip(min=0) total_steps +=1 return (loss/total_steps)
I am using an XGBoost model to classify some data. I have cv splits (train, val) and a separate test set that I never use until the end. I have used GridSearchCV to determine the best parameters and fed my cv splits (5 folds) into it as well as set refit=True so that once it figures out the best hyperparameters it trains on the full data (all folds as opposed to just 4/5 folds) and returns the best_estimator. I then …
I am trying to change the font size on all pages/posts on the site I'm managing for my employer. I know how to change the font size in "posts" but how do I change font size in "category" pages? I have tried looking into appearance editor to change the font size. I looked online at different codes to insert but it is unclear where to place the code or what follow on steps must be done. This is one of …
I am trying to build a pipeline in order to perform GridSearchCV to find the best parameters. I already split the data into train and validation and have the following code: column_transformer = make_pipeline( (OneHotEncoder(categories = cols)), (OrdinalEncoder(categories = X["grade"])), "passthrough") imputer = SimpleImputer(strategy='median') scaler = StandardScaler() model = SGDClassifier(loss='log',random_state=42,n_jobs=-1,warm_start=True) pipeline_sgdlogreg = make_pipeline(imputer, column_transformer, scaler, model) When I perform GridSearchCV I am getting the follwing error: "cannot use median strategy with non-numeric data (...)" I do not understand why am …
I'm trying to install Wordpress 5.3.2 on NetBSD (unix). phpinfo() tells me I am running Apache/2.4.33 (Unix) PHP/7.2.6 /wp-admin/setup-config.php?step=1 has a message at the bottom of the window (below the "submit" button) saying "There has been a critical error on your website". Thinking to set WP_DEBUG to "true" in the hope of getting an error message, I manually configured wp-config.php, but on install.php I get a blank screen. The server log says "Call to undefined function wp_kses_normalize_entities()". I've tried using …
I've spent a few days on this and am starting to think I'm missing the obvious solution as this doesn't seem like a very uncommon problem. As an example dataset: I have 100 measurements with each a different constant speed as target and a length of 10000 data points. Every measurement has additional 30 features that are temperatures, airflow, humidity, etc. My goal is to predict the speed depending on the features/conditions. My initial dataset so far has the shape …
I am trying to install wordpress into a subdirectory of a website. I simply want to build the client's new site in this subdirectory, so a separate and new WP install in this subdirectory, and then when complete, delete the current (old) site and move the new wp website from the subdirectory to the root. I've uploaded the wordpress into the subdirectory, I've completed the wp-config file, created my database... and I have double-checked and triple checked that my database …
I have a custom neural network that has been written from scratch in python and also a dataset where negative target/response values are impossible, however my model sometimes produces negatives forecasts/fits which I'd like to completely avoid. Rather than transform the input data or clip the final forecasts, I'd like to force my neural network to only product positive values (or values above a given threshold) during forward and back propagation. I believe I understand what needs to be done …
If I set the num_parallel tree to 1 and max_iteration to 1 in boosted_tree_regressor of Google Big Query ML will it work as Decision tree regressor ? Also can such decision tree give negative predictions even if the training data is 0 or greater ?
I have a CAD-like system: users create Canvases and put different Objects on it. Sometimes users need to scale the Canvas and move all included objects to different positions and probably change their sizes. At the moment it's done manually, but there's a need to automate this process, I'm trying to do this using ML algorithms. For the train data I have a bunch of manually scaled canvases Initially I thought it would be a relatively easy task achieved with …