#StackBounty: #python #search #grid #knn #imputation grid search with own estimator in python

Bounty: 50

I am trying to build my own estimator (regressor) and use it for imputation (KnnImputation).
For now – I wrote a very basic knn imputation, when it will work I will change the algorithm a bit.

I’m having a problem using the grid search “GridSearchCV”.
I tried to print the shapes of the data to get a sense of the problem. When the configuration is 10-fold cross validation I would expect the prints to be 10 times this lines:

xTrain size : 2487
yTrain size : 2487
test size : 276

But instead I get this lines:

xTrain size : 2487
yTrain size : 2487
test size : 276

test size : 2487

more the 60 times.

Any idea what is the problem?

My Code:

class KnnImputation(BaseEstimator, RegressorMixin):

    def __init__(self, k=5, distance='euclidean'):
        self.k = k
        self.distance = distance

    def get_params(self, deep=False):
        return {'k': self.k, 'distance': self.distance}

    def set_params(self, **parameters):
        self.k = parameters['k']
        self.distance = parameters['distance']

    def fit(self, X, y):
        self.xTrain = X.values
        self.yTrain = y.values
        print("nxTrain size : " + str(self.xTrain.shape[0]))
        print("yTrain size : " + str(self.yTrain.shape[0]))

        return self

    def predict(self, xTest):
        xTest = xTest.values
        num_test = xTest.shape[0]
        print("test size : " + str(num_test)+"n")
        yPred = np.zeros(num_test, dtype=self.yTrain.dtype).reshape(-1, 1)

        for i in range(num_test):
            distances = np.sum(np.abs(self.xTrain - xTest[i, :]), axis=1)
            idx = np.argsort(distances)
            minIndexes = idx[:self.k]
            kClosest = self.yTrain[minIndexes[:]]
            yPred[i] = np.mean(kClosest)

        return yPred

kf = KFold(n_splits=10, shuffle=False, random_state=23)
NN = KnnImputation()
gridSearchNN = GridSearchCV(NN, param_grid=params, scoring="neg_mean_squared_error", n_jobs=1,
                                cv=kf.split(xTrain, yTrain), verbose=1)
gridSearchNN.fit(X=xTrain, y=yTrain)

The Error:

  File "C:Users....dataImputation.py", line 85, in knnImputationMethod
    gridSearchNN.fit(X=xTrain, y=yTrain)
  File "C:Users...Anaconda3libsite-packagessklearnmodel_selection_search.py", line 740, in fit
    self.best_estimator_.fit(X, y, **fit_params)
AttributeError: 'NoneType' object has no attribute 'fit'


Get this bounty!!!

#StackBounty: #search #search-results #spfx #search-schema Fetching modern sharepoint page comments and likes count using search api

Bounty: 50

I can’t seem to find the correct managed property for both modern Comments Count & Likes Count at all as all managed property within schema returned 0 counts.
enter image description here

enter image description here

I would like to avoid additional query again just to get each items likes/comments count when querying news posts using search api.

https://pnp.github.io/pnpjs/sp/docs/comments-likes/


Get this bounty!!!

#StackBounty: #8 #search How to place facet block in views page header? (not regions)

Bounty: 50

I’ve created a search with Search API module and Facets module. I’ve added two taxonomy term name fields to my search index and created two facets for those fields. Just for testing I’ve placed the facet blocks in my main content area, and fulltext search and faceted filtering are working as expected.

Now I want to place the facet blocks in the header of the view, and not in a page region. I’ve checked the block source file and ID of the facet blocks is facet_block. Facet blocks are derived blocks, so my best guess was that the block ID should be facet_block:MACHINE_NAME_OF_FACET.

I’ve added a Global: Rendered entity - Block to the header of the view. As block ID I’ve entered the schema from above, e.g. facet_block:museum for my “museum” facet.

However, the facet block doesn’t show in the views header. (The same facets placed via block layout still work fine.)

Can anybody tell me how to render facet blocks inside a view header?

(I’m looking for a no-code-solution, without preprocessing or editing templates)


Get this bounty!!!

#StackBounty: #php #wp-query #query #search #tax-query How to create a WP_Query to search the Title or Tag?

Bounty: 50

I have created a search using WP_Query, it seems like this query is looking for the queried term in title AND tags.

Is there a way to have this search the title OR tags?

$s = $request['s'];
$tags = str_replace(' ', '-', strtolower($request['s']));

$paged = $request['page'];
$posts_per_page = $request['per_page'];

$result = new WP_Query([
    'post_type'         => 'post',
    'category__in'      => 3060,
    'posts_per_page'    => $posts_per_page,
    'paged'             => $page,
    'orderby'           => 'date',
    'order'             => 'desc',
    's'                 => $s,
    'tag'               => array($tags)
]);


Get this bounty!!!

#StackBounty: #windows #windows-10 #search Can't find .lnk shortcuts Windows 10

Bounty: 100

I have many .lnk shortcuts that I use on a daily basis, including multiple different users on Chrome and start locations for CMD. When I search their names on windows search (win+s), the shortcuts show up, but when I use any third party search applications (such as Cerebro, Wox, etc.), I can’t find them. Why is this?

It’s worth noting that I have only had this problem after switching to a new windows 10 laptop, on my old one .lnk files worked fine with Cerebro and Wox.


Get this bounty!!!

#StackBounty: #windows #windows-10 #search Can't find .lnk shortcuts Windows 10

Bounty: 100

I have many .lnk shortcuts that I use on a daily basis, including multiple different users on Chrome and start locations for CMD. When I search their names on windows search (win+s), the shortcuts show up, but when I use any third party search applications (such as Cerebro, Wox, etc.), I can’t find them. Why is this?

It’s worth noting that I have only had this problem after switching to a new windows 10 laptop, on my old one .lnk files worked fine with Cerebro and Wox.


Get this bounty!!!

#StackBounty: #windows #windows-10 #search Can't find .lnk shortcuts Windows 10

Bounty: 100

I have many .lnk shortcuts that I use on a daily basis, including multiple different users on Chrome and start locations for CMD. When I search their names on windows search (win+s), the shortcuts show up, but when I use any third party search applications (such as Cerebro, Wox, etc.), I can’t find them. Why is this?

It’s worth noting that I have only had this problem after switching to a new windows 10 laptop, on my old one .lnk files worked fine with Cerebro and Wox.


Get this bounty!!!

#StackBounty: #windows #windows-10 #search Can't find .lnk shortcuts Windows 10

Bounty: 100

I have many .lnk shortcuts that I use on a daily basis, including multiple different users on Chrome and start locations for CMD. When I search their names on windows search (win+s), the shortcuts show up, but when I use any third party search applications (such as Cerebro, Wox, etc.), I can’t find them. Why is this?

It’s worth noting that I have only had this problem after switching to a new windows 10 laptop, on my old one .lnk files worked fine with Cerebro and Wox.


Get this bounty!!!

#StackBounty: #windows #windows-10 #search Can't find .lnk shortcuts Windows 10

Bounty: 100

I have many .lnk shortcuts that I use on a daily basis, including multiple different users on Chrome and start locations for CMD. When I search their names on windows search (win+s), the shortcuts show up, but when I use any third party search applications (such as Cerebro, Wox, etc.), I can’t find them. Why is this?

It’s worth noting that I have only had this problem after switching to a new windows 10 laptop, on my old one .lnk files worked fine with Cerebro and Wox.


Get this bounty!!!

Apache Solr vs Elasticsearch: The Feature Smackdown

API

Feature Solr 5.3.0 ElasticSearch 2.0
Format XML,CSV,JSON JSON
HTTP REST API
Binary API SolrJ TransportClient, Thrift (through a plugin)
JMX support ES specific stats are exposed through the REST API
Official client libraries Java Java, Groovy, PHP, Ruby, Perl, Python, .NET, JavascriptOfficial list of clients
Community client libraries PHP, Ruby, Perl, Scala, Python, .NET, Javascript, Go, Erlang, Clojure Clojure, Cold Fusion, Erlang, Go, Groovy, Haskell, Java, JavaScript, .NET, OCaml, Perl, PHP, Python, R, Ruby, Scala, Smalltalk, Vert.x Complete list
3rd-party product integration (open-source) Drupal, Magento, Django, ColdFusion, WordPress, OpenCMS, Plone, Typo3, ez Publish, Symfony2, Riak (via Yokozuna) Drupal, Django, Symfony2, WordPress, CouchBase
3rd-party product integration (commercial) DataStax Enterprise Search, Cloudera Search, Hortonworks Data Platform, MapR SearchBlox, Hortonworks Data Platform, MapR etcComplete list
Output JSON, XML, PHP, Python, Ruby, CSV, Velocity, XSLT, native Java JSON, XML/HTML (via plugin)

Infrastructure

Feature Solr 5.3.0 ElasticSearch 2.0
Master-slave replication Only in non-SolrCloud. In SolrCloud, behaves identically to ES. Not an issue because shards are replicated across nodes.
Integrated snapshot and restore Filesystem Filesystem, AWS Cloud Plugin for S3 repositories, HDFS Plugin for Hadoop environments, Azure Cloud Plugin for Azure storage repositories

Indexing

Feature Solr 5.3.0 ElasticSearch 2.0
Data Import DataImportHandler – JDBC, CSV, XML, Tika, URL, Flat File [DEPRECATED in 2.x] Rivers modules – ActiveMQ, Amazon SQS, CouchDB, Dropbox, DynamoDB, FileSystem, Git, GitHub, Hazelcast, JDBC, JMS, Kafka, LDAP, MongoDB, neo4j, OAI, RabbitMQ, Redis, RSS, Sofa, Solr, St9, Subversion, Twitter, Wikipedia
ID field for updates and deduplication
DocValues
Partial Doc Updates with stored fields with _source field
Custom Analyzers and Tokenizers
Per-field analyzer chain
Per-doc/query analyzer chain
Synonyms Supports Solr and Wordnet synonym format
Multiple indexes
Near-Realtime Search/Indexing
Complex documents
Schemaless 4.4+
Multiple document types per schema One set of fields per schema, one schema per core
Online schema changes Schemaless mode or via dynamic fields. Only backward-compatible changes.
Apache Tika integration
Dynamic fields
Field copying via multi-fields
Hash-based deduplication Murmur plugin or ER plugin

Searching

Feature Solr 5.3.0 ElasticSearch 2.0
Lucene Query parsing
Structured Query DSL Need to programmatically create queries if going beyond Lucene query syntax.
Span queries via SOLR-2703
Spatial/geo search
Multi-point spatial search
Faceting Top N term accuracy can be controlled with shard_size
Advanced Faceting New JSON faceting API blog post
Geo-distance Faceting
Pivot Facets
More Like This
Boosting by functions
Boosting using scripting languages
Push Queries JIRA issue Percolation. Distributed percolation supported in 1.0
Field collapsing/Results grouping
Spellcheck Suggest API
Autocomplete
Query elevation workaround
Joins Joined index has to be single-shard and replicated across all nodes. via has_children and top_children queries
Resultset Scrolling New to 4.7.0 via scan search type
Filter queries also supports filtering by native scripts
Filter execution order local params and cache property
Alternative QueryParsers DisMax, eDisMax query_string, dis_max, match, multi_match etc
Negative boosting but awkward. Involves positively boosting the inverse set of negatively-boosted documents.
Search across multiple indexes it can search across multiple compatible collections
Result highlighting
Custom Similarity
Searcher warming on index reload Warmers API
Term Vectors API

Customizability

Feature Solr 5.3.0 ElasticSearch 2.0
Pluggable API endpoints
Pluggable search workflow via SearchComponents
Pluggable update workflow
Pluggable Analyzers/Tokenizers
Pluggable Field Types
Pluggable Function queries
Pluggable scoring scripts
Pluggable hashing
Pluggable webapps site plugin
Automated plugin installation Installable from GitHub, maven, sonatype or elasticsearch.org

 

Full article